I have the following structure in Firestore for my chats collection:
chats: [
chat1: {
jobs: [
jobs/job1,
jobs/job2,
jobs/job4
]
},
chat2: {
jobs: [
jobs/job2,
jobs/job3
]
}
]
If I'm on chat1
, and I have the data, then I have the array of references to jobs. I know I have jobs/job1
, jobs/job2
and jobs/job4
.
How can I query and get the data for all of these jobs?
I could do:
firestore.doc("jobs/job1").get()
and firestore.doc("jobs/job2").get()
and firestore.doc("jobs/job3").get()
but that seems very inefficient.
And I don't understand how I can filter firestore.collection("jobs")
to give me what I want.
I've seen a few other questions here asking the same thing, but for Java, and I'm unable to translate it into JavaScript.