【发布时间】:2020-04-25 16:20:06
【问题描述】:
我有以下文件:
"players" : [
{
"id" : userid,
"name" : "dissident"
},
{
"teamId" : teamId,
"name" : "ink"
}
]
这是我尝试过的,但它不起作用
this.afs.collection('matches', ref => ref.where('players', 'array-contains', {teamId: teamId}))
【问题讨论】:
-
您能否详细说明您的预期输出是什么?
-
错误是什么?
-
@Mridul 我只在玩家数组包含给定团队 id 时才尝试获取此文档
-
您是否将 JSON 称为文档?如果 teamid 与给定的团队 id 匹配,您想返回整个对象吗?
-
您可能对这个答案感兴趣:stackoverflow.com/questions/54081799/… 它解释了使用数组包含来查询存储在数组中的对象的特定属性是不可能的
标签: angular firebase google-cloud-firestore