How to create empty collection in Firestore Swift

前端 未结 2 1628
萌比男神i
萌比男神i 2020-12-20 23:53

How can I create an empty collection in Firestore (Swift)? i want to do that when I create DB users after I registrate them, because on my main screen it tries to fetch from

相关标签:
2条回答
  • 2020-12-21 00:32

    Collections are automatically created when you write a document to them. There is no way to create a collection without a document in it.

    0 讨论(0)
  • 2020-12-21 00:40

    There is no way you can create an empty collection in Cloud Firestore. To solve this, you should create at least one document within that collection. In this way, that particular collection will start to exist.

    If you create a collection in the Firebase Console containing one document, the collection is created automatically for you. This is also happening if you try to delete the last document in a collection, that particular collection will be automatically deleted.

    0 讨论(0)
提交回复
热议问题