[英]Parse: ParseError { code: 101, message: 'Object not found.' }
I have a cloud function running some code like this and I am able to get a response for my query which is a valid class instance, but when I try to update the instance with the set method, I get the error you see in the title. 我有一个运行这样的代码的云函数,并且能够为我的查询获得一个有效的类实例的响应,但是当我尝试使用set方法更新实例时,出现了标题中显示的错误。
async function addToDB(apiKey) {
const query = new Parse.Query(MyClass);
query.equalTo('apiKey', apiKey);
const response = await query.find({ useMasterKey: true });
const myInstance = response[0];
myInstance.set('total', 100);
try {
await myInstance.save({ useMasterKey: true });
} catch (e) {
console.log('E', e);
}
}
the options parameter ( { useMasterKey : true}
) should be the second parameter passed to save
options参数( { useMasterKey : true}
)应该是传递给save
的第二个参数
the first parameter to a save should be a null
, ie : 保存的第一个参数应为null
,即:
myInstance.save(null, { useMasterKey: true })
in essence, you are not passing the masterkey option in to the save call - which is why you are getting the 101 error (in my experience, a 101 is almost always related to permissions issues!) 本质上,您没有将masterkey选项传递给save调用-这就是为什么您会收到101错误的原因(根据我的经验,101几乎总是与权限问题有关!)
see more here http://parseplatform.org/Parse-SDK-JS/api/v1.11.1/Parse.Object.html#save 在此处查看更多信息http://parseplatform.org/Parse-SDK-JS/api/v1.11.1/Parse.Object.html#save
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.