0

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",
  }
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Mercies
  • 1
  • 2

1 Answers1

3

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.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Thanks Frank van Puffelen, Considering the single synthetic property, is it possible for me to achieve that on all collection of data in that lessons node? if yes, please how? – Mercies Oct 04 '17 at 13:59
  • I showed one synthetic property in my answer. I'm not sure what you're trying to filter on. I recommend you try to create a property for those values and then update your question. – Frank van Puffelen Oct 04 '17 at 14:13
  • Alright @Frank, If I am to create a multi-column index like this; ` "class_title": "Remedial classes_rocks and dirt" ` for each single entity, how can I generate these properties automatically, for a large documents(many records in the lessons node),an alternative to QueryBase, since it was mentioned that QueryBase is for experimenting. – Mercies Oct 04 '17 at 15:26
  • That's precisely what QueryBase does. There is no alternative library I know of, but you can write your own code to do the same of course. – Frank van Puffelen Oct 04 '17 at 16:05