使用对象元素作为参数的 Firestore 查询 [英] Firestore query using an object element as parameter
问题描述
我在一个项目中使用 Firestore 作为我的数据库,我有一个表,我需要在对象内进行查询
i'm using Firestore as my database in a project and i have a table that i need to do a query inside an object
{
foo: "data",
bar: "data",
exObject: {
dataToQuery: "value"
}
}
这里是一个结构的例子,我想在对象内部进行查询一个看起来像这样的查询:
here is an example of a structure where i want to do a query inside the object a query that would look like this:
dbRef.collection("Table").where("exObject.dataToQuery", "==", "value")
但这不起作用.
有没有办法使用对象的内部值作为参数在 Firestore 中进行查询?如果没有,有没有办法实现相同的结果?
Is there a way to query in Firestore using an object's inner value as parameter? If not, is there a way to achieve something that would give the same result?
Firestore 结构示例
Example of a Firestore Structure
推荐答案
dbRef.collection("Table").where("exObject.dataToQuery", "==", "value")
我第一次发布的这个语法确实是很好的语法,并最终开始工作.我将我的问题的原因归类为一个错字,我必须尝试很多不同的事情来纠正
this syntax i first posted is indeed the good syntax and started working eventually. I'd class the reason of my problem as a typo that i must have corrected trying a lot of different things
这篇关于使用对象元素作为参数的 Firestore 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!