我正在尝试使用Firestore编写我的第一个云功能。在很多问题/文章中,人们建议添加“{merge:true}”。那是做什么的?我在哪里可以阅读更多相关信息。
我的背景是Java。这可能是JavaScript的基础。非常感谢文档/文章正确方向的指针。
以下是Firestore云功能的示例:
exports.updateLikeCount2 = functions.firestore
.document('likes/{likeId}').onWrite((event) => {
admin.firestore.collections('ruleSets').document(ruleSetId).get().then(doc => {
admin.firestore.document('ruleSets/' + ruleSetId).set({likeCount2: oldCount}, { merge: true });
添加/删除{merge:true}做什么?
答案 0 :(得分:1)
documentation是你的朋友。从那里:
选项强>
配置设置行为的对象。传递
{merge: true}
仅替换data参数中指定的值。省略的字段将保持不变。