javascript - 使用 != 和 not-in 查询会在 firestore 中使用 Query.where 引发错误
问题描述
我尝试使用!=
和not-in
作为参数,如此处Query.where
所述:
db.collection("users")
.where(firebase.firestore.FieldPath.documentId(), "!=", curUser.uid)
.get()
.then((snapshot) => {
...
});
但我收到以下错误:
提供给函数 Query.where() 的第二个参数的无效值“!=”。可接受的值:<、<=、==、>=、>、array-contains、in、array-contains-any
我什至在一个普通的非文档 id 字段上尝试了这个,它给出了同样的错误。
我正在使用节点包firebase
版本 7.9.0。
解决方案
您需要使用最新版本才能使用不相等查询:
npm install firebase@8.0.0 --save
!=
发布版本7.21.0
:
https://firebase.google.com/support/release-notes/js#version_7210_-_september_17_2020
推荐阅读
- java - 如何在百里香中动态创建多个嵌套对象
- regex - 获取特定字符串之间的文本作为正则表达式中的不同字符串
- angular - 如何修复 Angular 发布请求中的“无法读取未定义的属性”错误
- python - 如何在 Counter 类中实现 __add__ 方法?
- python - 如何修复从视图到html的传递变量
- c++ - 使用 opencv 构建 WebAssembly
- batch-file - 截断和重命名目录中的子目录
- angular - 我应该如何在 Angular 8 中为 @ViewChild 使用新的静态选项?
- javascript - JS/JQuery:检测何时将子元素添加到父元素
- python - 如何从 PostgreSQL 表中获取浮点值作为浮点值而不是 psycopg2 中的十进制值?