OR Logical operation in Firestore Query

Viewed 2421

Is there any way to apply OR operation in firestore queries like:

if (name == "Jhon" || lastname == "James") { then do this }

1 Answers

It currently seems that Firestore does not support disjunctions.

Workaround would be to merge results of queries query.whereEqual(name, John) and query.whereEqual(surname, James).

Keep in mind, that from the result you have to delete the duplicated ones, those which are evaluated as true in both conditions.

Related