I'm doing a website which store users data on cloud firestore. I use this to get all subcollections of a user document once:
db.collection('users').doc(userID).getCollections().then( collections => {
/*I get my collections and I enjoy it :D*/
})
The problem is that this function is not recognized. I find this message on the console:
TypeError: db.collection(...).doc(...).getCollections is not a function
I know I could get the all subcollections otherwise but I want to save the maximum of readings because of de limited quota. All others firebase functions work in my project (like get()
or set()
) and getCollections()
is in the documentation.
Thank for your help !
Google team was replaced method name from 'getCollections' to 'listCollections'. So you should update this method name again. Reference at here https://googleapis.dev/nodejs/firestore/latest/DocumentReference.html#listCollections
It works for me with these tool versions: firebase-tools v7.2.1, firebase-admin v8.3.0, firebase-functions v3.2.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With