代码之家  ›  专栏  ›  技术社区  ›  Yushin

基于查询更新云FireStore中的文档

  •  2
  • Yushin  · 技术社区  · 7 年前

    是否可以使用包含WHERE子句的FireBase Cloud函数设置值?

    例如

    admin.firebase.firestore().collection('Accounts').where("imagePathName", '==', docNamed).set({
      original: 'trial'
    });
    

    这给了我一个错误。

    1 回复  |  直到 7 年前
        1
  •  4
  •   Doug Stevenson    7 年前

    set() 创建或更新由 DocumentReference

    查询没有set方法。相反,您必须使用 get() QuerySnapshot ,迭代,然后分别对每个文档调用set()。