How to perform compound queries with logical OR in Cloud Firestore?

后端 未结 9 1991
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 02:07

From the docs:

You can also chain multiple where() methods to create more specific queries (logical AND).

How can I perform an <

9条回答
  •  生来不讨喜
    2020-11-22 02:34

    suggest to give value for status as well.
    ex.

    { name: "a", statusValue = 10, status = 'open' }
    
    { name: "b", statusValue = 20, status = 'upcoming'}
    
    { name: "c", statusValue = 30, status = 'close'}
    

    you can query by ref.where('statusValue', '<=', 20) then both 'a' and 'b' will found.

    this can save your query cost and performance.

    btw, it is not fix all case.

提交回复
热议问题