Reputation: 873
What I am trying to do: I am using parse server with javaScript SDK to change a field value for an already existing user.
The code that i am using
var query = new Parse.Query(Parse.User);
query.equalTo("username", "someUserName");
query.find({
success: function(users){
console.log("user found", users);
users.set("name", "new name");
users.save(null,{
success: function(updated){
//worked
},
error: function(error, updated){
//didn't work
}
});
},
error: function(error, users){
console.error("error at querying: ", error);
}
});
The issue : this does not update the name field value.
What i have discovered from researching this issue : seems like i have to utilize the sessioToken or/and masterKey like this(show below) but that also did not work.
users.save(null,{useMasterKey:true}{
success: function(updated){
//worked
}
I am quite confused at the moment, any help would be appreciated.
Upvotes: 0
Views: 1876
Reputation: 164
Your master key or session token should be the first parameter.Have a look at the Parse.Object.save API
https://www.parse.com/docs/js/api/classes/Parse.Object.html
Try something like this
users.save({useMasterKey:true}, {
success: function(updated){
//worked
}
error: function(err){
}
});
Upvotes: 1