Last active
August 29, 2015 14:05
-
-
Save mhinton/c0c40d90d9aded20e71c to your computer and use it in GitHub Desktop.
Meteor Publish/Subscribe Issue
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
/* 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