Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm wondering if it's possible to return a list of values from my Firebase database where each element satisfies two conditions.

For example, if my database looked like this:

MYAPP
|_______________items
|                   |_____OshwYF72Jhd9bUw56W7d
|                   |                   |
|                   |                   |__item_name:"plank_5"
|                   |                   |__length:"120"            
|                   |                   |__width:"50"             
|                   |                            
|                   |_____KbHy4293dYgVtT9pdoW
|                   |_____PS8tgw53SnO892Jhweh
|                   |_____Gicuwy8r23ndoijdakr
|
|___customers

And I want to query the database for the item_name of every item that has a length of between 100-150 and a width of between 30-70, is there a way for me to do this with a Firebase query?

I've read the answers here: Query based on multiple where clauses in firebase but that doesn't deal with multiple between/range clauses, which is what I would need in the above scenario.

I saw this plugin in another answer: https://github.com/davideast/Querybase but the where clause doesn't seem to take a range of values. For example:

const queriedDbRef = querybaseRef
  .where({
    length: (between 100-150),
    width: (between 30-70)
  });

Is such a query even possible? Or will I have to get all items matching one condition, and then apply the second condition client-side, using Javascript?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
120 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...