Skip to content

Instantly share code, notes, and snippets.

@gwendall
Created October 30, 2014 11:56
Show Gist options
  • Save gwendall/f6ea636759d46c1782f1 to your computer and use it in GitHub Desktop.
Save gwendall/f6ea636759d46c1782f1 to your computer and use it in GitHub Desktop.
Posts = new Mongo.Collection("posts");
if (Meteor.isServer) {
Meteor.publish("posts", function(timeStamp) {
var selector = timeStamp ? { createdAt: { $gte: timeStamp }} : {};
var options = timeStamp ? {} : { limit: 10, sort: { createdAt: -1 }};
return Posts.find(selector, options);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment