使用对象元素作为参数的Firestore查询 [英] Firestore query using an object element as parameter

查看:68
本文介绍了使用对象元素作为参数的Firestore查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中将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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆