I need to find all document IDs with name: "Nick"
, so I can update the score
.
I have the following Firestore Database
structure:
{
"c4ca4238a0b923820dcc509a6f75849b": {
title: "Tiger",
user: {
name: "Chris",
score: 1
}
},
"c81e728d9d4c2f636f067f89cc14862c": {
title: "Lion",
user: {
name: "Nick",
score: 2
}
}
}
From the documentation I see that I can find documents using where
like this:
const dbQuery = query(collection(dbFirestore, "posts"), where("title", "==", "Tiger"));
const dbSnapshot = await getDocs(dbQuery);
dbSnapshot.forEach((result) => {
console.log(result.id, " => ", result.data());
});
But I don't see anything about how to search by a child element (user.name
)?