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?
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?
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
- general_unauthorized_scope
localhost oauth not working. general_unauthorized_scope error showing. { "message": "User (role: guests) missing scopes ([\"account\"])", "code": 401, ...
- I recently switched to TablesDb. When li...
olddb.list_documents( queries =[ Query.order_desc("timestamp"), Query.equal("isPosted",[False]) ] ) Above works fine and reruns documents But below don't return...
- Database error validating 'min' and 'max...
I keep seeing an error when I try to add a column to a database table within the AppWrite cloud UI. I also see this error when trying to create or update a reco...