Parse request.object.existed () return false

I have a problem with parse. I wrote a cloud code

Parse.Cloud.afterSave(Parse.User, function(request) { var user = request.object; if( !user.existed() ) { //all the times !user.existed() is true when I save user object //also in signup is true } }) 

how can i do the inside if the block is only executed if the user is a new user?

+5
source share
1 answer

This seems to be a Parse bug from the latest Parse Javascript SDK (1.6.7).

https://developers.facebook.com/bugs/1675561372679121/

Quick work (kindly provided by Andrey Patru in the topic above):

 var createdAt = request.object.get("createdAt"); var updatedAt = request.object.get("updatedAt"); var objectExisted = (createdAt.getTime() != updatedAt.getTime()); 

Just test it and it works.

+11
source

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


All Articles