I know several keys whose values I want. I want to get them all in one firebase realtime database call. Performance is king. If I know what I want and where it is on the database I should not have to make several queries to get the data.
For example, I can do an update to several paths at once as follows:
const updates = {};
const usermeta = {
username: username,
email: user.email,
lastlogin: unixEpoch,
signupdate: unixEpoch,
tier: tierChosen
};
updates[`/account/${uid}`] = usermeta;
updates[`/users/${username}`] = 1;
updates[`/fun/key/to/query`] = "Magic.";
updates[`/slow/key/to/query`] = "Not magic.";
updates[`/fast/key/to/query`] = "Magical.";
rootdb.ref().update(updates)
I know all my updates, make one call, done. Efficient, fast, low latency. How do I do the same on the read side? I don't want to listen to values. I want to retrieve them once. I know where they are, just get them all in one query.
Example, using the update data from above, say I want the data at keys/paths:
`/fun/key/to/query`
`/account/${uid}/username`
`/account/${uid}/signupdate`
`/slow/key/to/query`
How can I get them all on one read call to Firebase Realtime Database?
In the search I did prior to posting I could not find an answer to this. Every solution was to use listeners or make several calls.