小编Sam*_*yer的帖子

如何在 Firestore 中使用 android 的多个文档字段进行搜索?

我正在使用适用于 android 的 Firebase Firestore 来存储数据。我试图从文档中搜索数据。

我的 Firestore 结构是:

集合(产品)- 文档(自动生成的 ID)- 字段(NumberOfPeople,OfferStartDate,OfferEndDate,OfferPrice,Location)

我为这些字段的搜索数据编写了查询。

CollectionReference collectionOfProducts = db.collection("Products);

collectionOfProducts
                    .whereEqualTo("Location", location)
                    .whereGreaterThanOrEqualTo("OfferPrice", offerPrice)
                    .whereLessThanOrEqualTo("OfferPrice", offerPrice)
                    .whereGreaterThanOrEqualTo("OfferStartDate", date)
                    .whereLessThanOrEqualTo("OfferEndDate", date)
                    .get()
Run Code Online (Sandbox Code Playgroud)

我想要这样的搜索结果:在开始日期和结束日期之间的报价,其中报价在给定价格范围内大于等于或小于等于。此查询在 android studio 中不起作用。

如何在firestore firebase中做到这一点?

android firebase google-cloud-firestore

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

firebase ×1

google-cloud-firestore ×1