Automatically create collection in firestore
468
From the documentation:
Collections and documents are created implicitly in Cloud Firestore. Simply assign data to a document within a collection. If either the collection or document does not exist, Cloud Firestore creates it.
So to answer your question: It's not possible! The collection is created implicitly when you create a document and when you delete the last document in a collection, it will cease to exist.
Comments
-
Bennett567 over 1 year
is it possible to update this method:
void uploadMatch(team1, team2) { Firestore.instance.collection("upcomings").add({ "createdAt": Timestamp.now(), "upcomingTeam1": team1, "upcomingTeam2": team2 }); }
so that if the upcomings collection doesn't exist, it creates it? Thanks!