Firebase Multiple Clauses

Asked

Viewed 21 times

0

I’m looking to make a query with multiple clauses Where, with the database Firestore, but returns me an error, I did a quick search I saw that the Firestore only lets you make a single clause Where in a collection; i tried to make a separate query and then join them, but to no avail. It ends up returning duplicate data.

In the example below I have a store, and in this store I have some products, the user can do a filtering by the "product name" and also by the "product price"

The error I get when I try to do this operation is this Exception:

All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on 'FieldPath([name_product])' and 'FieldPath([price])'.

When I try to use a method like this:

db.collection('store')
  .where('name_product', isGreaterThanOrEqualTo: 'name_product')
  .where('name_product', isLessThanOrEqualTo: 'name_product' + "\uf8ff")
  .where('price', isGreaterThan: '10000')
  .snapshots();

The above example was written in Dart language.

1 answer

0


  • Please add more details to expand your response, such as a working code or documentation quotes.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.