Skip to content
Advertisement

Tag: google-cloud-firestore

Firebase 9 – How to do new doc ref

Hello guys i’ve been trying to convert this code into modular firebase 9: fb8: const userRef = db.collection(‘Users’).doc(); to fb9: const userRef = doc(db, ‘Users’); But i’m getting this error: FirebaseError: Invalid document reference. Document references must have an even number of segments, but Users has 1. Please help! Answer The doc() method is equivalent to .collection(‘users’).doc(‘docID’) where you need

delete a collection with document and collection again inside (firestore react native)

I am having trouble deleting on firestore here’s my delete but everytime i try to delete nothing happens . There’s no error at all . this is how I set that collection Answer If you want to delete all the docs of the messages (sub)collection, you need to query the collection and delete each document, for example by using Promise.all()

Advertisement