Using the model below, I need to use the where
operator when querying Firestore. However, the where
attribute is nested based on the following variable code:
where("category", "==", "Something"),
const language = "EN" { EN: { category: "Something in english" }, FR: { category: "Something in french" } }
P粉4959559862023-09-09 10:20:34
To be able to query a collection based on the values present in the map, you should use the where
function call like this:
where("EN.category", "==", "Some Category")
If you need to change the language, then you should consider using variables instead of hard-coded values. In code it should look like this:
where('${language}.category', "==", "Some Category")