What is the most efficient way to make a batch query in Firebase DB based on an array of known keys?

I need a solution that calls the Firebase DB API for several key-based elements and returns the data (children) of these keys (in one answer).

Since I don't need data to come in real time, some standard REST call made once (and not a Firebase DB listener), I think that would be ideal.

There would be no other listener in the application, and the WebSocket connection is open. However, I looked through the Firebase API docs and it doesn't seem like there is a way to do this.

Most of the answers I've seen always suggest making a composite key / index of a certain type and filtering accordingly using a composite key, but this only works for searching by range. Or they suggest simply investing data and not worry about backups and disk space (and faster), instead of getting related data through foreign keys.

However, the problem is that I use Geofire, and its query method returns only the keys of the elements, not the data of the elements. All documents and previous answers involve receiving data either using the real-time SDK, which I tried to use using the once method or making a REST call for all elements and filtering with orderBy , startAt , endAt and locally filtering the keys I need.

This might work, but the potential overhead of extracting a lot of elements that I don't need only to filter them seems wasteful. The approach using the once listener seems wasteful because it represents a server route for each element. This approach is explained in this pretty good post , but according to this explanation, it still makes a circuit for each element (even if it is asynchronous and through the same connection).

This poor soul asked a similar question , but did not receive many useful answers (which really take into account the cost of creating n number of server requests).

Can someone explain the approaches to how this can be done, and the pros / cons once and for all? Thanks.

+8
javascript rest firebase firebase-database geofire
source share

No one has answered this question yet.

See similar questions:

80
Speed ​​up message retrieval for my application on the social network using a query instead of re-observing a single event
3
Only retrieve objects with specified keys in Firebase from a large index
one
Get Key-Based Children (Firebase)

or similar:

5101
What is the most efficient way to deeply clone an object in JavaScript?
534
Most efficient way to create a null filled JavaScript array?
379
What is the most efficient way to create HTML elements using jQuery?
211
What is the most efficient way to concatenate N arrays?
2
Error filtering data in firebase database
2
The request is larger / smaller than when using the request # startAt / endAt
one
Geofire queries and filters some data (server-side) to limit bandwidth usage
0
Geofire integration with existing firebase database
0
Firebase Timestamp Filter
0
How to use startbt firebase method with "value" and "key" in a REST request?

All Articles