Skip to content Skip to sidebar Skip to footer

How To Add A Collection Inside Document On Firestore? React Native

async componentDidMount() { firebase.firestore().collection('profiles').get().then(function(querySnapshot) { querySnapshot.forEach(function(doc) { var d

Solution 1:

Since you already have a DocumentSnapshot for the document that you want to create a subcollection under, you can build the CollectionReference and DocumentReference to the new document from that.

Something like this should work:

const profileRef = doc.ref.collection('private').doc('pushToken');

Post a Comment for "How To Add A Collection Inside Document On Firestore? React Native"