My aim is to get users that have id listed in an array.
EXAMPLE: I have an array of id's
const usersId = [222, 444, 555, 522]
and I want to get all users with those id's. each id is unique, meaning there can be only one user with that id.
I looked in the docs and from what I understood I need to handle this programmatically. So my only choice is to make a get
request for each id?
this can be problematic because they can be more then a couple hundreds
this is my helper func:
export const getById = (id) => {
db.collection('users')
.where('id', '==', id)
.get()
.then(querySnapshot => {
querySnapshot.forEach(doc => {
console.log(doc.id, " => ", doc.data());
});
})
}
and this is a simplified example for the loop:
usersId.forEach(id => {
getById(id);
})
Is there a better way to handle this?
Thanks