Skip to content

Instantly share code, notes, and snippets.

@jhgaylor
Forked from mhinton/pubsub_issue.js
Created August 8, 2014 15:14
Show Gist options
  • Save jhgaylor/ff096e12614c5d36499e to your computer and use it in GitHub Desktop.
Save jhgaylor/ff096e12614c5d36499e to your computer and use it in GitHub Desktop.
/* file: server/data.js */
Meteor.publish("helptexts",function() {
return HelpTexts.find();
});
Meteor.publish("publishTest", function () {
return HelpTexts.find({_id: "help-demo"});
});
/* file: client/base.js */
if (!window.HelpTexts) { HelpTexts = new Meteor.Collection("helptexts"); }
if (!window.PublishTest) { PublishTest = new Meteor.Collection("publishTest"); }
helptexts_subscription = Meteor.subscribe("helptexts");
publish_test_subscription = Meteor.subscribe("publishTest");
/* in Chrome javascript console */
HelpTexts.findOne({_id: "help-demo"}); // <- returns the document
PublishTest.findOne(); // <- returns undefined
PublishTest.find({_id: "help-demo"}).fetch(); // <- returns []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment