FlutterFirestore:在同一个查询中使用whereNotIn和arrayContains解析查询参数时发生错误
我的查询是:
snapshot = await FirebaseFirestore.instance
.collection('dialogs')
.where('active', isEqualTo: true)
.where('users', arrayContains: globals.user.userId)
.where('readers', whereNotIn: [globals.user.userId])
.orderBy('priority')
.limit(1)
.get();
我收到上述异常:
未处理的异常:[cloud_firestore/unknown] 解析查询参数时出错,有关详细信息,请参阅本机日志。
我在Firestore官方文档中找到了一些注释:
- 每个查询最多可以使用一个 in
not-in、 或array-contains-any子句。您不能在同一个查询中组合这些运算符。 - 您不能将 not-in 与 not equals != 结合使用。
就我而言,一切都应该没问题。
我也尝试了几件事:
- 如果我只删除该
whereNotIn行,一切都很好。 - 如果我只删除该
arrayContains行,一切都很好。
为什么我会收到查询解析异常?谢谢
THE END
二维码