I am looking to create subcollections with React Native Firebase to create a firestore structure like this:
groups
->group
->scheduledQuestionnaires
->questionnaire (fields: id, type and timestamp)
users
->user
->groups
(fields: id and name)
I have created the collections groups
and users
, but how can I create a subcollection scheduledQuestionnaires
for every group programmatically.
I am able to add documents with fields to collections just fine, but I can't seem to find a way to create (sub)collections. Am I going the wrong way about it or am I missing something?
EDIT To add to the answer by monsty. Here is a code snippet of what I wanted to do:
firestore()
.collection('groups')
.doc('group1/scheduledQuestionnaires/questionnaire1')
.set({
id: '1',
type: 'type',
timestamp: 'timestamp',
});