Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Meteor.methods({
- 'Listing.update': function(docId, data) {
- var doc = db.listings.findOne({_id: docId}) || {};
- if (doc.userId !== this.userId) {
- throw new Meteor.Error(504, "You don't own post");
- }
- // ensure data is the type we expect
- check(data, {
- title: String,
- desc: String
- });
- return db.listings.update(docId, {$set: data});
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement