I am trying to make a firestore structure similar to the following:
collection (userID) --> document (courseID) --> subcollection (lectureID) --> Q&A arrays
where the userID, courseID, and lectureID are all randomly generated values by firestore. Using authentication via firebase allows for the userID to be randomly generated, and the code below works well to create a course with a random courseID:
firestore.collection(authorId).add({
(...)
However, I'm running into issues trying to create a subcollection with a random Id. At first I was trying to do something such as:
firestore.collection(authorID).doc(courseID).add({
(...)
but the .add() apparently doesn't work for subcollections. Is there another function I can use that will allow me to create a subcollection?