Skip to content

Overriding response data with data.save #3266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
srameshr opened this issue Dec 21, 2016 · 1 comment
Closed

Overriding response data with data.save #3266

srameshr opened this issue Dec 21, 2016 · 1 comment

Comments

@srameshr
Copy link
Contributor

query.first().then(function(data) {
  var newName = "ABC";
  data.set("name", newName);
  data.save({useMasterKey: true}).then(function(data) {
    response.success(data);
  })
})

This fails with the error message

error: Error generating response. ParseError {
  code: 141,
  message: ParseError { code: 101, message: 'Object not found.' } } code=141, code=101, message=Object not found.

The same piece of code worked before updating parse-server today morning. Any ideas on how to override values on data without calling data.save() ?

@srameshr
Copy link
Contributor Author

Found the solution for this. You have to explicitly pass null into save() if you dont have any data to save. What I did was:

query.first().then(function(data) {
  var newName = "ABC";
  data.set("name", newName);
  data.save(null, {useMasterKey: true}).then(function(data) {
    response.success(data);
  })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant