30
rated 0 times
[
35]
[
5]
/ answers: 1 / hits: 6113
/ 3 Years ago, wed, june 30, 2021, 12:00:00
So, i want to query some data from firestore.
this is my data structure
so, the collection is Modules, then i now have 2 documents but it will be 75 or something. Then in that document i want to get the specific document which has a specific LessonId (In this example '2')
How do i query this?
this is wat i tries but it's not working for me
async function getModuleData() {
let ModuleData = await firebase
.firestore()
.collection('Modules')
.where('Lessons', 'array-contains', {LessonId: 2})
.get()
.then(snapshot => {
snapshot.forEach(doc => {
console.log(doc.data())
})
});
} getModuleData()
when i do this
async function getModuleData() {
let ModuleData = await firebase
.firestore()
.collection('Modules')
.where('Title', '==', 'Leven vanuit verlossing')
.get()
.then(snapshot => {
snapshot.forEach(doc => {
console.log(doc.data())
})
});
} getModuleData()
it just works so it's something with my where statement i guess?
More From » firebase