如何使用云代码beforesave更改模式



给定以下模式

{
 date: '2017-12-09',
 amount: 10.00,
 notify: true,
 isInvoiceSent: false
}

假设我决定删除列isinvoicesent,我如何使用云代码和beforesave删除该列?

Parse.Cloud.beforeSave("Invoice", function(request, response) {
  delete request.object.isInvoiceSent # <-- won't work
  response.success();
});

主要原因是因为在禁用列创建后,我得到了:

Permission denied for action addField on class Invoice

您可以使用'req.object.unset(" isInvoicesent")'

请参阅:http://parseplatform.org/parse-sdk-js/api/v1.11.11.0/parse.object.html#unset for More Infos!

最新更新