【问题标题】:How to update a document in a collection group, Firebase Firestore Web V9如何更新集合组中的文档,Firebase Firestore Web V9
【发布时间】:2023-02-10 04:25:10
【问题描述】:

我有个收藏群transactions/pullout_requests/requests/

我已经设法获取并向其中添加数据,但我不知道如何更新其中的文档。我有我需要更新的文档 ID。我在docs中找不到update

【问题讨论】:

    标签: javascript firebase google-cloud-firestore


    【解决方案1】:

    查看文档的 update a document 部分。在 v9 中,应该是:

    import { doc, updateDoc } from "firebase/firestore";
    
    const docRef = doc(db, "col", "doc_id");
    
    await updateDoc(docRef, {
      capital: true
    });
    

    【讨论】:

      猜你喜欢
      • 2021-05-12
      • 1970-01-01
      • 1970-01-01
      • 2018-10-21
      • 2019-01-29
      • 2020-10-03
      • 2020-08-25
      • 2021-07-22
      • 1970-01-01
      相关资源
      最近更新 更多