javascript - Firebase - IN查询在where子句中不起作用,结果是空白数组
问题描述
当我尝试使用 IN 查询过滤我的数据时,它没有向我显示结果我得到一个空白数组,我在 firebase 控制台中尝试了同样的事情。我也没有在那里得到结果。
我的数据是 messages/01fjubNOf8oYODitr1h6 在这条路径中,我有键 - 名称、消息、参与者
{
name: "Pawan arora",
message: "test",
participants: ["33", "127"]
},
{
name: "TEST NAME",
message: "not working",
participants: ["114", "127"]
}
{
name: "TEST DATA",
message: "new",
participants: ["114", "33"]
}
我尝试在查询中过滤我的查询的数据
.collection("messages").where("participants", "in", ["33", "127"])
在这里我应该得到第一个对象
解决方案
array-contains-any
过滤数组时需要使用运算符。
尝试这个:
.collection("messages").where("participants", "array-contains-any", ["33", "127"])
有关详细信息,请查看此博文。
推荐阅读
- python - 熊猫中按组分组的唯一值的一年滚动计数
- html - css html 定位 网页设计
- json - 如何将数据从mongodb导出到json
- angularjs - 默认情况下,如何在文件夹内导航以访问我的索引、html 文件
- python - 如果我使用批量标准化但设置 batch_size=1 会发生什么?
- google-cloud-platform - 如何安排从 BigQuery 表到 Cloud Storage 的导出?
- android - Android Studio Gradle 任务重命名库
- c++ - 几个 Nt 函数在 Windows 7 x32 上返回 STATUS_WAIT_0
- excel - 有没有办法将 Range 变量重新分配给不同的范围?
- python - 如何在没有任何输出数据的情况下预测连续变量?我所拥有的只是输入数据