I want to know if sub collection 'categories'
is created inside my users
collection in Firestore and return true if created and false if not
Asked
Active
Viewed 772 times
0

Shakar Bakr
- 57
- 1
- 10
1 Answers
1
Subcollections are not really created. They simply appear to exist as soon as a document is first added to it, and they appear to be removed as soon as the last document is deleted.
If you want to know if a subcollection appears to exist, then all you have to do is query it. If it returns documents, then you know it exists. You can limit the query to 1 document to be efficient about it.

Doug Stevenson
- 297,357
- 32
- 422
- 441
-
1Thank you so much, But can you give me the query for it? – Shakar Bakr Nov 15 '19 at 15:54