You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi ,
i am using parse server and mongo db on ubuntu 14.04 LTS
I have written some cloud script in which
i am getting user object from request and console.log(request.user) print below object
ParseUser { _objCount: 0, className: '_User', id: 'YK8c12J1xb' }
then i have increment the count by 1 and save that but in error handler "object not found for update " was printing and user not updating .
like below
request.user.increment("publicTitleCount", 1);
Activity
gfosco commentedon Feb 23, 2016
Add the useMasterKey:true option to your save call to affect a user from cloud code:
Same with the find:
This should solve your issue... let me know if not. Thanks.
redblinkdevs commentedon Feb 23, 2016
Hi ,
I had user this
var user= request.user;
if (request.object.get("isPrivate")) {
user.increment("privateTitleCount", 1);
} else {
user.increment("publicTitleCount", 1);
}
request.object.increment("subsciptions",1);
user.set("publicTitleCount", 1);
console.log(user+" jj");
user.save(null,{ useMasterKey: true }).then((user) => {
console.log(user+" saved");
}, (error) => {
console.log(error.message+" got error");
});
it still print "object not found for update"