0

I am using the Firebase RealTime Database and I have the following keys in my data.

joinDate
isVerified
otherInfo

Now what I want is to orderBy joinDate but only get keys that have isVerified = true

I have the following query

let localRef=ref.orderByChild("isVerified").equalTo(true);

But as firebase only allows one orderby function. The above query will orderBy "isVerified" key.

How to I achive this.

Thanks

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
krv
  • 2,830
  • 7
  • 40
  • 79
  • client side with a loop/iteration? – Ronnie Royston Feb 19 '18 at 03:35
  • 2
    Firebase Database queries can only order/filter on a single property. In many cases it is possible to combine the values you want to filter on into a single (synthetic) property, such as `"isVerified_joinDate": "true_20180218"` and then `ref.orderByChild("isVerified_joinDate").startAt("true_")`. For an example of this and other approaches, see my answer here: http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Feb 19 '18 at 03:37

0 Answers0