如何在安全之前访问已更改的关系

时间:2014-09-12 14:51:19

标签: parse-platform before-save

我想跟踪云端的一些后端变化。

我的before_save的日志告诉我这样的事情:

before_save triggered for Elements for user oKwM9mvEUn:
  Input: {
  "original":
    {"elements":[
        {"__type":"Pointer","className":"Element","objectId":"VzeuG3Z5N6"},
        {"__type":"Pointer","className":"Element","objectId":"APkHJpgcms"},
        {"__type":"Pointer","className":"Element","objectId":"xHG1jg8fny"}
        ]},

    "update":
    {"elements":[
      {"__type":"Pointer","className":"Element","objectId":"VzeuG3Z5N6"},
      {"__type":"Pointer","className":"Element","objectId":"xHG1jg8fny"}
      ]}
    }

  Result: Update changed to 
  {"elements":[
  {"__type":"Pointer","className":"Element","objectId":"VzeuG3Z5N6"},
  {"__type":"Pointer","className":"Element","objectId":"xHG1jg8fny"}
  ]}

dirtyKeys告诉我"元素"已被更改,但我想知道究竟添加(或删除)了什么,因为我只想跟踪更改......

是否有可能访问这些"更新"值?或者我必须自己在其他房产中跟踪它?

感谢您的提示!

1 个答案:

答案 0 :(得分:0)

当我在similar question上发布时,您可以使用以下方式获取关系更改详细信息:

request.operation.op(yourFieldName)

返回Parse.Op.Relation个对象。