我有 2 个查询想要在我的 Firestore 集合中使用。
这 2 个示例有效:
database
.collection('servicebonnen')
.where('medewerker', '==', 'CEES')
和:
database
.collection('servicebonnen')
.where('date', '>', this.today)
.where('date', '<', this.tomorrow)
为什么像这样组合这些不起作用?:
database
.collection('servicebonnen')
.where('medewerker', '==', 'CEES')
.where('date', '>', this.today)
.where('date', '<', this.tomorrow)
最佳答案
如 firestore doc here 中所述:
You can also chain multiple where() methods to create more specific queries (logical AND). However, to combine the equality operator (==) with a range or array-contains clause (<, <=, >, >=, or array_contains), make sure to create a composite index.
所以你需要创建composite index在你的情况下。
关于javascript - 为什么这些查询独立工作而不是一起工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55462255/