I am starting a new firebase project and using ionic to make it a hybrid app. This is a learning experience for me, that will hopefully grow into a full on app. For the time being I am trying to figure out how to get a batch of users at once. Let say my app allows people to "follow" other people, like IG for example. So I have a database called "following" in that database there are user ids, each user id will have a key called "users" which will list out all of the users that that user is following...
{
"following" : {
"$userID": {
"count": 2,
"users": {
"$userID": true,
"$userID": true
}
},
...
}
}
Obviously the "$userID" would be a real user ID. Now if a user has something like 100 followers, I would have a long list of user IDs. I am trying to find a way to get all of those users from the "users" table in one go, rather than having to make 100 individual database calls, or 1 for each user. I can't find anything in the documentation that shows how to get a batch of items except for startAt or endAt, but neither of those apply, since they will be random user ids, and not a sequential list. Making 100 (or even 1k or more) individual calls to the database seems extremely inefficient. Is there any way to get a batch of results? If you need it, the user ID is the $key from the "/users" table, so the database calls would be something like...
this.db.database.ref('/users/' + userID).once('value', (snapshot) => { ... }); Thank you for any help in advance.