Created
April 3, 2015 15:22
-
-
Save AlexFrazer/af847b0369b246ea6fc4 to your computer and use it in GitHub Desktop.
An example of publications and subscriptions
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
// browser | |
> Meteor.users.findOne() | |
{ | |
_id: "1234" | |
} | |
// console | |
> Meteor.users.findOne() | |
{ | |
_id: "1234", | |
profile: { | |
name: "Jack Sparrow" | |
}, | |
services: [{ | |
github: { | |
token: "56789", | |
username: "Jack Sparrow" | |
} | |
}] |
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
Tracker.autorun(function() { | |
Meteor.subscribe('userdata'); | |
}) |
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('userdata', function() { | |
return Meteor.users.find({}. { | |
fields: { | |
_id: true | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment