Skip to content

Instantly share code, notes, and snippets.

var app = require('./app');
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = 3000;
io.on('connection', function(socket) {
console.log("A user connected.");
});
!!! WARNING The following tests failed:
*** [err]: Detect write load to master in tests/integration/replication-psync.tcl
Can't detect write load from background clients.
*** [err]: Detect write load to master in tests/integration/replication-psync.tcl
Can't detect write load from background clients.
*** [err]: Test replication partial resync: no backlog in tests/integration/replication-psync.tcl
Expected condition '[s -1 sync_partial_err] > 0' to be true ([s -1 sync_partial_err] > 0)
*** [err]: Detect write load to master in tests/integration/replication-psync.tcl
Can't detect write load from background clients.
11 users: function () {
12 return Meteor.users.find({'status.online': true});
13 }
# in `users` helper
return Meteor.users.find({'status.online': true})
# in mongodb client:
db.getCollection('users').find({'status.online': true})
# returns 2 results
# in the client, I have two users logged in, but each user
# can only see their own user name in the list of currently
# logged in users.
if Meteor.isServer
Meteor.publish "userData", () ->
if this.userId
return Meteor.users.find {_id: this.userId}, {fields: {'status.online': 1}}
else
this.read()
Meteor.publish "messageData", () ->
return Messages.find {createdAt: {$gte: moment().subtract(1, 'days')}}
# in this code snippet I'm trying to get all messages that were created less than a day ago
# it doesn't seem to be working.
Meteor.publish "messageData", () ->
return Messages.find {}, {createdAt: {$lte: moment().subtract(1, 'hours')}}
date = moment().subtract(5, 'hours').toDate()
return Messages.find {createdAt: {$gte: date}}
> Messages = new Mongo.Collection("messages")
Error: A method named '/messages/insert' is already defined
> Messages
ReferenceError: Messages is not defined
Meteor.publish "messageData", () ->
date = moment().subtract(5, 'hours').toDate()
return Messages.find {createdAt: {$gte: date}}