Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a Collection in Firestore with node.js code

I cannot figure out how to create a new Collection with the node.js firestore api. Any suggestions?

like image 277
Greg Avatar asked Oct 07 '17 18:10

Greg


People also ask

How do I create a collection in firestore node?

Collections are automatically created when you add/write a document to them. There is no need (nor API) to explicitly create a collection. From the documentation: Collections and documents are created implicitly in Cloud Firestore.

Does Firestore automatically create collections?

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.


1 Answers

Collections are automatically created when you add/write a document to them. There is no need (nor API) to explicitly create a collection.

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.

like image 181
Frank van Puffelen Avatar answered Sep 28 '22 09:09

Frank van Puffelen