Friday 15 January 2010

Meteor collection.update permisions -


Hello, I do not understand why this is not working?

  Notifications.update ({'UserId': Meteor.userId (), 'notifyUserId': notifyFriendId}, {$ set: {read: 1}});   

I also have the update permission method

  notifications = new meteor. Compile ('notifications'); Notifications. Lof ({update: function (userid, doctor) {returns true;}});   

Error appearing:

  Unwanted error: Not allowed. Untrusted code can only update the document by id [403]    

A collection You can only use _id of the document to update. You have to ask first question for this

  var docid = Notifications.findOne ({'userId': Meteor.userId (), 'notifyUserId': notifyFriendId}); Notifications. Update ({_ id: docid._id}, {$ set: {read: 1}});   

This is the only code running for the client. On the server you can run the code as you did.

No comments:

Post a Comment