Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.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
Node.js 如何进行“反向查询”;数组包含";[火炉店]_Node.js_Firebase_Google Cloud Firestore - Fatal编程技术网

Node.js 如何进行“反向查询”;数组包含";[火炉店]

Node.js 如何进行“反向查询”;数组包含";[火炉店],node.js,firebase,google-cloud-firestore,Node.js,Firebase,Google Cloud Firestore,我在firestore集合中有一组用户ID。 我想在NodeJS中进行查询,以获取不包含特定id的每个文档 db.collection("freeMusic").where("userIds", "array-contains", "ABB56WnLNWdbWNTyItrRiQyfgCU2") .get() 这就是我如何在数组userid中获取哪个文档中有特定的用户ID的方法,但我如何反向获取 如何查询

我在firestore集合中有一组用户ID。 我想在NodeJS中进行查询,以获取不包含特定id的每个文档

db.collection("freeMusic").where("userIds", "array-contains", "ABB56WnLNWdbWNTyItrRiQyfgCU2")
      .get()
这就是我如何在数组
userid
中获取哪个文档中有特定的用户ID的方法,但我如何反向获取

如何查询数组中不包含特定值的每个文档


注意:这个用户ID数组的长度可以大到超过100个

那么
where(“用户ID”、“不在”、“abb56wnlnwdbwntytriqyfgcu2”)?
是否可以在一个查询中将其与多个where条件相结合?您可以尝试以下方法:
var ref=db.collection(“freeMusic”);参考where(“userIds”、“notin”、“abb56wnlnwdbwntytriqyfgcu2”);ref=ref.where(“userid”,“notin”,“xkk]”);ref=ref.where;ref.get()即使您的答案不在,我也只能得到一个包含用户ID的查询
。where(“answeredUids”,“notin”,“ZBZ53WnLNWdbWNTyIekRiQyhoCK2]”)和结果
“answeredUids”:[“ZBZ53WNLNWBWNTYIEKRIQYHOCK2”]
我将两个问题链接到了你的问题。在一篇文章中,Doug解释了为什么Firestore上不可能进行这种查询(它总是回到能够满足其性能保证的问题上)。在另一个例子中,Jay解释了一个可能也适用于您的用例的数据模型。