Blame view

server/publications/example.js 560 Bytes
0436f3083   Ryan Glover   Add example publi...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  /*
  * Publications: Example
  * Data publications for the Example collection.
  */
  
  Meteor.publish('examplePublication', function(){
    // If need be, Meteor gives us access to the current user via this.userId.
    // Example below shows using this.userId to locate documents where the
    // owner field is equal to a userId. Additionally, a fields projection is
    // added to specify which fields you want to return (where 1 = true and
    // 0 = false).
  
    var user = this.userId;
    var data = Example.find({"owner": user}, {fields: {"owner": 1}});
  
    return data;
  });