I am using Firestore to store a Friend List for my iOS app, which is using Swift.

each document in my `friends` collection has a `sender`, `target`, and `accepted` field

when the user opens their friend list I need the app to retrieve every document where their user ID is in either the `target` or `sender` fields, and only where `accepted == true`

I know I can chain `.where()` functions to create AND queries.

but as far as I can see it's not possible to do OR queries with Firestore.

Is there a way to do this in one query?

Thanks

**EDIT**

Here is a snapshot of the database structure

[![enter image description here](https://i.stack.imgur.com/ky5CT.png)](https://i.stack.imgur.com/ky5CT.png)

Each document is created when a friend request is sent and is then used to build the friend list for both users when required (rather than storing 2 arrays of user IDs which have to be updated separately whenever a change is made)