【发布时间】:2021-03-29 17:30:45
【问题描述】:
我在 firestore 中有下一个数据结构:
{
"votes_yes":[
"id1",
"id2",
"id3",
...
],
"votes_no":[
"id4",
"id5",
"id6",
...
],
}
我想构建一个查询,它将返回用户投票的文档列表。
为此,我需要检查他的 id 是否存在于其中一个数组中。
在array-contains 的帮助下,我可以轻松地为一个数组做到这一点:
ref.where('votes_yes', 'array-contains', `userId`).get()
但是可以为array-contains 做logical OR 吗?
我在doc 中没有发现任何有用的东西... :(
【问题讨论】:
标签: javascript arrays firebase google-cloud-firestore