[英]Update Firestore document from cloud function
Trying to update the field score from a particular document in collection users :尝试从集合users 中的特定文档更新字段分数:
Can find this documented here for all languages except the only one that works with Firebase CLI除了唯一一种适用于 Firebase CLI 的语言之外,可以在此处找到所有语言的文档
This is what I'm trying based on those examples:这是我根据这些示例尝试的内容:
exports.updateScore = functions.https.onRequest((req: any, res: any) => {
admin.firestore().collection("users").document("asdfoij32").update("score", 44);
return res.send('That's done')
});
It's throwing this error:它抛出这个错误:
TypeError: admin.firestore(...).collection(...).document is not a function
nodejs JavaScript API 使用doc()而不是 document() 从 CollectionReference 构建 DocumentReference。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.