How to perform sql “LIKE” operation on firebase?

前端 未结 5 1526
别那么骄傲
别那么骄傲 2020-11-22 04:16

I am using firebase for data storage. The data structure is like this:

products:{
   product1:{
      name:\"chocolate\",
   }
   product2:{
      name:\"cho         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 05:02

    I believe you can do :

    admin
    .database()
    .ref('/vals')
    .orderByChild('name')
    .startAt('cho')
    .endAt("cho\uf8ff")
    .once('value')
    .then(c => res.send(c.val()));
    

    this will find vals whose name are starting with cho.

    source

提交回复
热议问题