0

I am using Firebase Cloud Functions on my Realtime Database. I am running a simple function to get the total users of my project but keep getting the same error:

The data requested exceeds the maximum size that can be accessed with a single request

Here is my code.

let collectionRef = admin.database().ref('users');
    return collectionRef.once('value', function(snap) {
        console.log('users: ' + snap.numChildren());
    });

I estimated around 11,000 + users. Is there anyway to get the numChildren of a specific location in the realtime database with such a large count?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
temp_
  • 1,238
  • 2
  • 12
  • 24
  • I believe each child under 'users' is too large. And would exceed the 1MB limit collectively. So I will have to find another method to count them. – temp_ Nov 30 '18 at 17:53
  • Possible duplicate of [In Firebase, is there a way to get the number of children of a node without loading all the node data?](https://stackoverflow.com/questions/15148803/in-firebase-is-there-a-way-to-get-the-number-of-children-of-a-node-without-load) – Jake Lee Nov 30 '18 at 23:17

0 Answers0