Wildcard query on Firebase?

后端 未结 4 368
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 05:22

Is it possible to do wildcard queries on Firebase? For example:

https://foo.firebaseio.com/person.json?orderBy=\"name\"&equalTo=\"Lun*\"
4条回答
  •  北海茫月
    2020-12-10 05:30

    You can do something like this.

    Make sure you order your search field alphabetically.

    Then you search for all names (starting at Lun and ending at Luo) where the last letter 'o' is calculated with the initial last letter 'n' + 1.

    I guess you see the general idea here.

    So it should return anything between 'Lun*' and stop at the first entry of 'Luo*'

    https://foo.firebaseio.com/person.json?orderBy="name"&startAt="Lun"&endAt="Luo"
    

提交回复
热议问题