Mercies
Mercies

Reputation: 1

Firebase search through multiple fields in a child node

I am using Angular 4 with Angularfire2, I need my users to search and view lessons list, through title and description. Please any alternative way to QueryBase will be so appreciated.

"lessons": {
  "lessonKey1": {
    "title": "rocks and dirt",
    "description": "introductory....",
    "class": "Remedial classes",
  }

Upvotes: 0

Views: 1605

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598740

The Firebase Realtime Database only support queries on a single child property.

In many cases it may be possible to work around this limitation by combining the values you want to filter on into a single synthetic property, e.g. "class_title": "Remedial classes_rocks and dirt".

QueryBase mostly automates the generation of such synthetic properties and queries on them.

To learn more about your options for filtering on multiple properties, see my answer here: http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase.

As an alternative you may want to have a look at the just-launched Cloud Firestore. It's a brand new database from the folks at Firebase, with a better query model.

Upvotes: 3

Related Questions