Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. Meteor.methods({
  2.  
  3. 'Listing.update': function(docId, data) {
  4.  
  5. var doc = db.listings.findOne({_id: docId}) || {};
  6.  
  7. if (doc.userId !== this.userId) {
  8. throw new Meteor.Error(504, "You don't own post");
  9. }
  10.  
  11. // ensure data is the type we expect
  12. check(data, {
  13. title: String,
  14. desc: String
  15. });
  16.  
  17. return db.listings.update(docId, {$set: data});
  18. }
  19.  
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement