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

后端 未结 9 1660
没有蜡笔的小新
没有蜡笔的小新 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:40

    I would have no "status" field, but status related fields, updating them to true or false based on request, like

    { name: "a", status_open: true, status_upcoming: false, status_closed: false}
    

    However, check Firebase Cloud Functions. You could have a function listening status changes, updating status related properties like

    { name: "a", status: "open", status_open: true, status_upcoming: false, status_closed: false}
    

    one or the other, your query could be just

    ...where('status_open','==',true)...
    

    Hope it helps.

提交回复
热议问题