I’m quite new to firestore/ionic so apologies in advance if this question is silly.
I’m working on an Ionic3 project using firestore for my database and was wondering, how do you create an empty document (i.e. a document with an id, but no other fields/values)? I’ve been able to do this by hardcoding through the firestore console but I was wondering how to do it from inside my code?
For some context, I have a ‘classes’ collection and each class’s document needs to contain multiple student IDs to indicate which students are enrolled in the class. I only need the IDs to be stored (no other fields).
Currently, I’ve been doing this like this:
this.afs.collection('classes').doc(data).collection('students').add({studentId: this.userId});
but this creates an unnecessary auto-generated ID.
Is there any way to create a document with just an ID field, and if not, how else might I be able to do this?
Thanks in advance!