Is it possible to have either or whereFields for Firestore query?

前端 未结 1 1906
天涯浪人
天涯浪人 2021-01-25 00:21

I want to have a query like

db.collection(\"Bookings\")
    .whereField(\"servicer\", isEqualTo: userID || \"customer\", isEqualTo: userID)

In

相关标签:
1条回答
  • 2021-01-25 00:46

    This is not possible with a single query - there is no logical OR operation that works across multiple fields in a document. You will need to have two queries, one for "servicer", and another for "customer", then merge the results of those queries on the client.

    0 讨论(0)
提交回复
热议问题