How to query objects in the CloudCode beforeSave?

前端 未结 4 1832
太阳男子
太阳男子 2021-01-23 16:52

I\'m trying to compare a new object with the original using CloudCode beforeSave function. I need to compare a field sent in t

4条回答
  •  渐次进展
    2021-01-23 17:12

    Hey this worked perfectly for me :

    var dirtyKeys = request.object.dirtyKeys();
    var query = new Parse.Query("Question");
    var clonedData = null;
            query.equalTo("objectId", request.object.id);
            query.find().then(function(data){
                var clonedPatch = request.object.toJSON();
                clonedData = data[0];
                clonedData = clonedData.toJSON();
                console.log("this is the data : ", clonedData, clonedPatch, dirtyKeys);
                response.success();
            }).then(null, function(err){
                console.log("the error is : ", err);
            });
    

提交回复
热议问题