使用 != 和 not-in 进行查询会在 firestore 中使用 Query.where 引发错误

Ric*_*ard 3 javascript firebase google-cloud-firestore

我尝试使用!=not-in作为参数,如下Query.where所述:

    db.collection("users")
      .where(firebase.firestore.FieldPath.documentId(), "!=", curUser.uid)
      .get()
      .then((snapshot) => {
         ...
      });
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

为函数 Query.where() 的第二个参数提供的值“!=”无效。可接受的值:<、<=、==、>=、>、array-contains、in、array-contains-any

我什至在普通的非文档 ID 字段上尝试过此操作,但它给出了相同的错误。

我使用的是节点包firebase版本 7.9.0。

Pet*_*dad 5

您需要使用最新版本才能使用不等于查询:

npm install firebase@8.0.0 --save
Run Code Online (Sandbox Code Playgroud)

!=发布版本7.21.0

https://firebase.google.com/support/release-notes/js#version_7210_-_september_17_2020