-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Description
if I have a Numeric field and increment it using the sdk something like
...
someTestClassQuery.find().then(function(results) {
results[0].increment("MyNumericField");
results[0].save();
and I have cloudcode something like:
Parse.Cloud.beforeSave("TestClass", function(request, response) {
var fieldValue=req.object.get('MyNumericField'); //this holds the expected field value, already incremented.
var jsonBody = {};
jsonBody.object = req.object.toJSON();
jsonBody.object.className = req.object.className;
/*at this point, jsonBody.object has lost its actual current value, and its replaced by an IncrementOp with a value of 1.
var unmarshalled = JSON.parse(jsonBody.object);
this object is not the same as req.object.
var fieldValueb=req.object.get('MyNumericField'); returns IncrementOp, not value
*/
how should I properly marshall/unmarshall parse objects such that they maintain their integrity?
thanks
Metadata
Metadata
Assignees
Labels
No labels