-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Parse.Object.save() does not return the same thing on parse-server and on Parse.com #653
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
Comments
If I recall correctly this |
Hi, Thank you for your response. Yes When I log the result of the REST API call, I also got the object without any of the modifications (in this example, the
Yet the modifications are done into the database. I forgot to mention that I use the last release version of parse-server. |
I don't think |
I actually managed to replicate this now and I'm in the process of tracking it down. I think this issue can be closed though as I'm pretty sure it is the same as #457 (as you mentioned) and it's better described there. @Kira2 Can you verify that it is the same problem by checking that the values gets correctly set in the database, just not passed to the beforeSave? |
Hi, Sorry for the delayed response. @gfosco request.object.isNew() works fine for me since the last version. I have integration tests for my application that validate it. If you remove it from the beforeSave function, the problem is still the same. @simonbengtsson The values are correctly set into the database. If I execute the code I wrote above, but by using JSON.stringify(object) like @gfosco suggested, this is what I have: // logged into the function with console.log()
{
"title":"The Old Man and the Sea",
"createdAt":"2016-02-26T19:06:49.569Z",
"updatedAt":"2016-02-26T19:06:49.569Z",
"objectId":"gtOfbwTohf"
} // when I log the result of the call of "createBook"
{
"title":"The Old Man and the Sea",
"createdAt":"2016-02-26T19:06:49.569Z",
"updatedAt":"2016-02-26T19:06:49.569Z",
"objectId":"gtOfbwTohf",
"__type":"Object",
"className":"Book"
} Thanks. |
Hi, As you said, I can close this one as it seems to be the same thing than #457 and that you gave a better description in the other post. Thanks. |
Hi,
I have several Cloud Code functions that I call using the Rest API, and that update some objects. At the end of the functions, the modified object is returned by using response.success(). When I call the same functions with parse-server, the response is different.
This is an example to reproduce it.
Create a beforeSave trigger and a Cloud Code function like this:
If the code is deployed on Parse.com, and you call the function "createBook" using the REST API, the new "Book" object is returned by response.success(). The line with console.log() displays the object returned by save():
If you use parse-server locally, the result of the save() operation is different, and the object returned by response.success() is different too (the "auto" field is missing). The line with console.log() displays the object returned by save() on parse-server:
So, all my code that returns the result of the save() operation into response.success() does not work anymore.
Thanks.
The text was updated successfully, but these errors were encountered: