我有一个称为session的文档结构,其中包含一个名为seances的数组,其中有一个名为Student的数组。
我想检索所有具有给定值的学生数组中的文档;例如,如果值是Alice,并且我有以下3个文档:
文档1
{
name: "doc1"
seances: [
{
date: "02/01",
students: ["Alice","John","Brahim"]
}
]
}
文档2
{
name: "doc2"
seances: [
{
date: "12/04",
students: ["Alice","John","Brahim"]
}
]
}
文档3
{
name: "doc3"
seances: [
{
date: "21/03",
students: ["Arysse","John","Brahim"]
},
{
date: "22/05",
students: ["Steward","John","Brahim"]
}
]
}
在这种情况下,它应该返回Doc 1和Doc 2,因为它在数组Student中包含了值“ Alice”,尽管存在其他字段,例如date,该数组中仍然包含数组会话。
是否可以仅使用带firestore的where子句来做到这一点?