How can I differ from add or update from the afterSave function?

Hello,

In our logic, we will need to do different things for adding new row or updating existing row in mongodb in the afterSave cloud function, how should I do? Thanks a lot.

I am not sure if I understood your question right, but I am using following to check if object is new:

Parse.Cloud.afterSave("Msg", async ({object, log}) => {   
    if (object.existed()) {
        //your code for e new object 
    } else {

    }
    return;   
});

Is this what have you been looking for? There are also some details in this thread

1 Like