I have been using python appwrite sdk and for some reason the Query.not_equal() does not filter out the values for attribute in list.. is this a bug or error from my side?
docs = bot.appwrite_databases.list_documents(
DISCORD_DATABASE_ID,
COMMAND_USAGE_COLLECTION_ID,
queries=[
Query.is_not_null('user_id'),
Query.not_equal('user_id', ['854259184141074472', '1088367284357177404']),
]
)```
so the docs with those user_ids still show..
there is no error hence i didnt share any exception ss
also Query.equal
works with that list of user ids
this
Query.not_equal('user_id', ['854259184141074472', '1088367284357177404']
means
user_id != '854259184141074472" OR user_id != '1088367284357177404'
which will always resolve to True
in practice. it doesn't make sense to pass a list to not_equal
Then why does it take an array? I would have assumed this was using not in
.
Oh but with that logic Query.equal() seems weird as well since it is meant for matching any of the values in list because of OR operation but Query.not_equal() will not work with each value separately
Maybe the not_equal() should follow AND operation instead
Try to add two not_equal
like so
docs = bot.appwrite_databases.list_documents(
DISCORD_DATABASE_ID,
COMMAND_USAGE_COLLECTION_ID,
queries=[
Query.is_not_null('user_id'),
Query.not_equal('user_id', ['854259184141074472']),
Query.not_equal('user_id', ['1088367284357177404']),
]
)
I can do that but for big lists that seems weird .. but yea ig i can iterate through and add the query for each value in my queries variable
Thanks for the help
Yes, I agree it can look too much just for that.
But all good since it does the job
How do you close the forum 😅
<a:agooglethumbsup:635256484682530825>
Click Edit here And add [SOLVED] in front of the question
Or you mean something else?
Ohh thanks
Query.not_equal() doesn't work with a list? [SOLVED]
Recommended threads
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...
- Appwrite exception: user_unauthorized, t...
After refreshing the app it is working perfectly