gpt4 book ai didi

firebase - 在 firestore 中自动创建集合

转载 作者:行者123 更新时间:2023-12-05 04:59:17 25 4
gpt4 key购买 nike

是否可以更新此方法:

void uploadMatch(team1, team2) {
Firestore.instance.collection("upcomings").add({
"createdAt": Timestamp.now(),
"upcomingTeam1": team1,
"upcomingTeam2": team2
});
}

如果 comcomings 集合不存在,它会创建它吗?谢谢!

最佳答案

来自documentation :

Collections and documents are created implicitly in Cloud Firestore.Simply assign data to a document within a collection. If either thecollection or document does not exist, Cloud Firestore creates it.

所以回答你的问题:这是不可能的! 集合是在您创建文档时隐式创建的,当您删除集合中的最后一个文档时,它将不复存在。

关于firebase - 在 firestore 中自动创建集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63580594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com