1

I'm trying to query on multiple keys in my Firebase database

-users
  -De0pYw8liHRCZBBtoDibLoINbNA3
    -displayName: Bobby Davidson
    -email: bobDavidson@gmail.com
    -username: bobbyD1981

Given a single input (i.e., "bobby"), how can I setup my firebase query to match on both the displayName and username of the above user simultaneously?

I currently have the following which matches only on the username

var ref = firebase.database().ref('users');
ref.orderByChild('username').startAt(input).endAt(input + "\uf8ff").once("value")

Thanks for any help!

Clay Banks
  • 4,483
  • 15
  • 71
  • 143
  • Firebase Database queries can only order/filter on a single property. You may be able to combine the values that you want to filter on into a single property. See http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase. – Frank van Puffelen Apr 29 '17 at 18:00

0 Answers0