Skip to content Skip to sidebar Skip to footer

Why Ref.getcollections() Is Not Recognized As A Function?

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().the

Solution 1:

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.

Solution 2:

In your example db.collection('users').doc(userID) returns DocumentReference and as far I can see DocumentReference object doesn't support getCollections method

Here is the documentation https://firebase.google.com/docs/reference/js/firebase.firestore.DocumentReference

Post a Comment for "Why Ref.getcollections() Is Not Recognized As A Function?"