Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Declare publication
- Meteor.publish('messages_by_thread', function (questionId) {
- check(questionId, String);
- // perform additional security checks here
- const channel = 'HZSos4nBiJfQRKgeA';
- console.log(channel);
- return Questions.find({ _id: 'HZSos4nBiJfQRKgeA' });
- });
- // Subscribe
- Template.schedulesFooter.onCreated(() => {
- const self = Template.instance();
- self.autorun(() => {
- self.subscribe('messages_by_thread', 'HZSos4nBiJfQRKgeA');
- return undefined;
- });
- });
- // Declare method (server-side only)
- Meteor.methods({
- 'questions.typing': function (questionId) {
- check(questionId, String);
- const random = () => Random.id();
- SyntheticMutator.update(Questions, 'HZSos4nBiJfQRKgeA', {
- $set: { // you can use any modifier supported by minimongo
- random: random(),
- },
- });
- },
- })
- // Call method
- Meteor.call('questions.typing', 'HZSos4nBiJfQRKgeA');
- /**
- * No errors in console or anywhere.
- * But I can't see the random field anywhere in my minimongo.
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement