Harry
Harry

Reputation: 54939

Firebase get length of object / number of children in object

Is there a way to get the number of children of an object without downloading the entire object? From what I understand using numChildren would first download the entire object, would it not?

Upvotes: 4

Views: 1320

Answers (1)

Anant
Anant

Reputation: 7428

Yes, currently it would. Getting the number of children without downloading the entire object is currently not possible (though it may be a feature added in the future).

As a work-around, you may try storing the length in a separate location in Firebase (and update its value whenever children are added or removed).

Upvotes: 3

Related Questions