英文:
How to update a document in a subcollection, Firebase Firestore Web V9
问题
我已经能够获取并添加数据到子集合 transactions/pullout_requests/requests/
中,但我不知道如何更新其中的文档。我有需要更新的文档的文档 ID,但在 文档 中找不到 update
方法。
英文:
i have a subcollection transactions/pullout_requests/requests/
I've managed to get and add data to it, but I don't know how to update a document in it. I have the document id of what I need to update. I can't find the update
in the docs
答案1
得分: 2
请查看更新文档文档部分。在v9中,应该是:
import { doc, updateDoc } from "firebase/firestore";
const docRef = doc(db, "transactions", "pullout_requests", "requests", "FeLv89oA6vN2wcJAmTo4");
await updateDoc(docRef, {
capital: true
});
英文:
Checkout update a document section of the documentation. In v9, that should be:
import { doc, updateDoc } from "firebase/firestore";
const docRef = doc(db, "transactions", "pullout_requests", "requests", "FeLv89oA6vN2wcJAmTo4");
await updateDoc(docRef, {
capital: true
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论