使用下面的模型,我在查询 Firestore 时需要使用 where 运算符。但是,where 属性是基于以下变量代码嵌套的:
where("category", "==", "Something"),
const language = "EN"
{
EN: {
category: "Something in english"
},
FR: {
category: "Something in french"
}
} Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
为了能够根据地图中存在的值查询集合,您应该使用如下所示的
where函数调用:where("EN.category", "==", "Some Category")如果您需要更改语言,那么您应该考虑使用变量而不是硬编码值。在代码中,它应该如下所示:
where('${language}.category', "==", "Some Category")