Skip to content

Instantly share code, notes, and snippets.

@brlafreniere
Created April 4, 2015 05:21
Show Gist options
  • Save brlafreniere/c97c77bf31cf87092ef6 to your computer and use it in GitHub Desktop.
Save brlafreniere/c97c77bf31cf87092ef6 to your computer and use it in GitHub Desktop.
function messageData () {
var fiveHoursAgo = unixTimestampSeconds() - 5 * 60 * 60;
return Messages.find({unixTimestamp: {$gte: fiveHoursAgo}});
}
function userData () {
return Meteor.users.find({}, {fields: {'status.online': 1, username: 1}});
}
if (Meteor.isServer) {
console.log(messageData.fetch()) // this shows me 2 results
Meteor.publish("userData", userData);
Meteor.publish("messageData", messageData); // is this working? who knoooows...
Meteor.startup(function () {
// code to run on server at startup
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment