Skip to content

Commit

Permalink
Step 10.9: Limit data sent to the client
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored and DAB0mB committed Dec 14, 2016
1 parent a76d857 commit e839918
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion server/imports/publications/parties.ts
@@ -1,4 +1,24 @@
import { Meteor } from 'meteor/meteor';
import { Parties } from '../../../both/collections/parties.collection';

Meteor.publish('parties', () => Parties.find());
Meteor.publish('parties', function() {
const selector = {
$or: [{
// party is public
public: true
},
// or
{
// current user is the owner
$and: [{
owner: this.userId
}, {
owner: {
$exists: true
}
}]
}]
};

return Parties.find(selector);
});

0 comments on commit e839918

Please sign in to comment.