How to query objects in the CloudCode beforeSave?

前端 未结 4 1794
太阳男子
太阳男子 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:11

    If I were you, I would pass in the old value as a parameter to the cloud function so that you can access it under request.params.(name of parameter). I don't believe that there is another way to get the old value. An old SO question said that you can use .get(), but you're claiming that that is not working. Unless you actually already had 9999 in the version...

    edit - I guess beforeSave isn't called like a normal function... so create an "update version" function that passes in the current Task and the version you're trying to update to, perhaps?

提交回复
热议问题