首页 > 解决方案 > 过滤顺序会影响 Firestore 中的查询结果吗?

问题描述

我有一个使用 where 子句获取一些 Firestore 数据的查询。(我正在使用angularfire2

代码:

this.db.collection('trips', ref => ref.where('origin', '==', this.trip.origin)
                                  .where('destination', '==', this.trip.destination)
                                  .where('avaiableSeats', '>', 0))

我遇到的问题是,对于相同的数据,该查询不返回任何内容

但是,如果我像这样更改目的地来源

this.db.collection('trips',ref=>ref.where('destination', '==', this.trip.destination)
                                  .where('origin', '==', this.trip.origin)
                                  .where('avaiableSeats', '>', 0))

突然,所有对象都正确返回。知道为什么或发生了什么吗?

标签: typescriptfirebasegoogle-cloud-firestoreangularfire2

解决方案


推荐阅读