本文介绍了错误:无实体可更新:应用程序-Firestore Cloud功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我非常基本的Cloud Function:
This is my very basic Cloud Function:
const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); const db = admin.firestore() exports.createdNewAccount = functions.auth.user().onCreate(event => { return db.collection('users').doc(event.data.uid).update({ "creationDate" : Date.now() }) })我得到了错误
错误:没有要更新的实体:应用
Error: no entity to update: app
我的代码有什么问题?
推荐答案event.data.uid的文档很可能不存在. update()的文档指出:
Most likely, the document for event.data.uid does not exist. The documentation for update() states:
如果将更新应用于不存在的文档,更新将失败.
The update will fail if applied to a document that does not exist.
改为使用 set().
更多推荐
错误:无实体可更新:应用程序
发布评论