简体   繁体   English

解析:ParseError {代码:101,消息:“未找到对象”。 }

[英]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.

相关问题 在Cloud Code中找不到101对象-解析服务器 - 101 Object not found in Cloud Code - Parse Server {“代码”:101,“错误”:“找不到要更新的对象”} Parse.com Javascript SDK - {“code”:101,“error”:“object not found for update”} Parse.com Javascript SDK 猫鼬错误:`{“ message”:“找不到匹配的文档。”,“ name”:“ VersionError”}` - Mongoose Error: `{“message”:“No matching document found.”,“name”:“VersionError”}` 未找到请求的合同。 确保源代码可用于编译 - The requested contract was not found. Make sure the source code is available for compilation IndexedDB“操作失败,因为找不到请求的数据库对象。 ” - IndexedDB “The operation failed because the requested database object could not be found. ” Parse.com无法创建新对象,错误代码:找不到用于更新/删除的对象 - Parse.com Failed to create new object, with error code: object not found for update / delete 错误:root:未找到哈希 md5 的代码。 npm安装出错 - ERROR:root:code for hash md5 was not found. Error in npm install Google Scripts 错误:“未找到名为 index.html 的 HTML 文件。 (第 2 行,文件“代码”,项目“版本 1”)” - Google Scripts Error: “No HTML file named index.html was found. (line 2, file ”Code“, project ”Version 1“)” 未找到 Npm 模块“”。 是否已安装? - Npm module "" not found. Is it installed? 找不到405方法。 在本地主机上 - 405 method not found. On localhost
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM