This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 users: function () { | |
12 return Meteor.users.find({'status.online': true}); | |
13 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Meteor.isServer | |
Meteor.publish "userData", () -> | |
if this.userId | |
return Meteor.users.find {_id: this.userId}, {fields: {'status.online': 1}} | |
else | |
this.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.publish "messageData", () -> | |
return Messages.find {createdAt: {$gte: moment().subtract(1, 'days')}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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')}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date = moment().subtract(5, 'hours').toDate() | |
return Messages.find {createdAt: {$gte: date}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Messages = new Mongo.Collection("messages") | |
Error: A method named '/messages/insert' is already defined | |
> Messages | |
ReferenceError: Messages is not defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.publish "messageData", () -> | |
date = moment().subtract(5, 'hours').toDate() | |
return Messages.find {createdAt: {$gte: date}} |