Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Querying data from Firebase using multiple filters

I have a Firebase array called products that contains items like this one:

JhMIecX5K47gt0VaoQN: {
    brand: "Esprit"
    category: "Clothes",
    gender: "Boys",
    name: "Pants",
}

Is it possible to query products from this array using multiple filters with the Firebase API. For example I might want to filter by brand and category (all "Pants" by "Esprit"). So far I've tried ordering by child key and then limiting the start and end of this ordering, but I can't figure out how to apply more filters.

I'm using the iOS SDK.

like image 320
maxjvh Avatar asked Mar 16 '26 04:03

maxjvh


1 Answers

Firebase can only order/filter on one property (or value) at a time. If you call a orderBy... method multiple times in a single query it will raise an error to indicate this is not allowed.

like image 83
Frank van Puffelen Avatar answered Mar 18 '26 22:03

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!