Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase 在Firestore中查询对象数组中的子对象_Firebase_Google Cloud Firestore - Fatal编程技术网

Firebase 在Firestore中查询对象数组中的子对象

Firebase 在Firestore中查询对象数组中的子对象,firebase,google-cloud-firestore,Firebase,Google Cloud Firestore,我正在尝试在firestore集合中查找数组字段的元素 这是firestore中的字段: channels: [{name: "linkedin", date: "2020-01-02"}] 以下是我尝试查询它的方式: firebase.firestore().collection("users") .where("status", "==", "ACTIVE") .where("channels", "array-contains", { name: "linkedin"

我正在尝试在firestore集合中查找数组字段的元素

这是firestore中的字段:

channels: [{name: "linkedin", date: "2020-01-02"}]
以下是我尝试查询它的方式:

firebase.firestore().collection("users")
  .where("status", "==", "ACTIVE")
  .where("channels", "array-contains", {
      name: "linkedin"                     
  })

数组包含
无法对属性的对象特定值执行搜索

如果你做一些像
频道:[“Linkedin”、“facebook”、“twitter”]

可能您希望尝试对通道使用子集合,否则,您需要将所有值提取到通道中,然后在内存中应用过滤器