Is there a way to check if beforeSave is called for a new Parse object or to update an existing object?

I need to check (and take appropriate action) if the object is just being created, or if an existing object is updated with new values. Is there any way to verify this for sure?

+5
source share
1 answer

Yes there is. The new object does not yet have an identifier, so you can check the object if it has an identifier.

Parse.Cloud.beforeSave("MyClass", function (request, response) { var object = request.object; if (!object.id) { // this is a new object } }); 
+11
source

Source: https://habr.com/ru/post/1203012/


All Articles