![](https://cdn.discordapp.com/avatars/277550305175142411/e5cf8a94643860435d21c3502a23b250.webp)
I was trying to query documents based on multiple variables.
Currently I am using Query.equal('users', [selectedUser, currentUser])
Seems this doesn't work as expected. I also couldn't find a Query.contains
or something similar
Any workaround?
![](https://cdn.discordapp.com/avatars/277550305175142411/e5cf8a94643860435d21c3502a23b250.webp)
Just noticed a post from Feb 25 - 2022 about this exact issue talking about Query.search as a hack. Is it expected to be fixed soon since it's been about 2 years now?
![](https://cdn.discordapp.com/avatars/277550305175142411/e5cf8a94643860435d21c3502a23b250.webp)
This can't be the right way to do it? (works tho)
let chat = await databases.listDocuments(
process.env.NEXT_PUBLIC_DATABASE,
process.env.NEXT_PUBLIC_DATABASE_CHATS,
[
Query.equal(
'users',
`${currentUser},${selectedUser}`
),
]
)
if (!chat.documents.length) {
chat = await databases.listDocuments(
process.env.NEXT_PUBLIC_DATABASE,
process.env.NEXT_PUBLIC_DATABASE_CHATS,
[
Query.equal(
'users',
`${selectedUser},${currentUser}`
),
]
)
}
saving it to users attribute as:
users: `${currentUser},${selectedUser}`
Recommended threads
- How to generate a database-setup script ...
I've written a vue.js webapp with appwrite-cloud-db (including relations) and everything works just perfectly! Now I want to release this webapp as an open sou...
- Issues with storage/database adding func...
Hi, I`m working on a register form where I need to upload a document to a storage as well as creating a new document in my database. For some reason I get an ex...
- Server Error - 500 when Loading Messagin...
Hi, I'm self hosting on a VPS my appwrite database and was working towards setting up an SMTP server, when testing I got an error due to some mishaps with the S...
![](/images/bgs/pre-footer.png)