if so, then it is not helpful for notEqual
and it makes sense why it returns back all my existing data
When you pass multiple values, it becomes OR.
But again, this is not supported on array attributes
i see... do you think in future, there may be a possibility to have a query method that will check notEqual against an array, but using AND, instead of OR?
similar to SQL's "NOT IN"
Yes, we do want to add support for arrays...something might be coming in our next release...I can't remember
yay! thanks so much Steven
No, this should work. Array operations are joined with "OR" operations
Nvm I see steven has responded π
[SOLVED] NotEqual comparison error
Thanks @VincentGe , yeah it works as an OR operator, but it defeats my purpose because it just returns back all records in DB π
You can pass them as separate queries
Each query string is logically separated via AND. For OR logic, pass multiple values, separated by commas:
Do 3 separate not equal queries instead of one with an array π
so [sdk.query.notEqual(field, "a"), sdk.query.notEqual(field, "b"), ...]
aha! by any chance, would you know if appwrite has a limit of how many query string is permitted per query? If i have to separate the NotEqual queries, I will need to dynamically append it >5k times as i have those large number of data to compare. Ideally array will work best for me.
I will give it a try.
Thanks for this suggestion, @VincentGe
I think there's a limit of 100 queries in a single API call
ah. ok. thanks @Steven
π₯Ή 5000 not equal operations? That's really interesting, I wonder if there are ways to optimize that from the design side. It is quite extreme, even if you're writing SQL.
I guess you'd normally do like a left outer join π€
If you'd like to share your use case, it would help us improve Appwrite <:appwritepeepo:902865250427215882> We love hearing use cases we have not imagined before!
Absolutely. So, everyday, I am doing a validation (via a batch job) to verify whether the existing "Research Papers" records that i have inserted in DB is missing. I would scan all the papers from a webpage, then verify whether any of the old paper was removed (it happens). If I have a record in my DB, but not in the webpage, it means the paper was already taken down. And I want to be aware of that.
NotEqual Array is the best for me because i can push all the papers into the Array and it will only return me the record that does not exist. But, the NotEqual Array is doing OR, which means it does not serve my purpose.
Right now, i will wait for AppWrite to support Array (AND operator).
in SQL, I usually just do "NOT IN (list of records)" and that solves my problem
Does it need to be executed synchronously?
Maybe you can have a function that:
- Fetches all research papers
- Creates a hash/map/set so i can do a O(1) lookup
- Iterates over all Research Papers in the appwrite database (list documents with cursor based pagination)
- Checks if document is in hash/map/set from step 2
- If it isn't, delete the document.
One way to improve this is to maintain a list of all the research papers in a secondary metadata collection or maybe a file in Storage. Then, instead of using list documents to get the research papers from the Appwrite Database, you can use the list
ok, i will give this a try. Thanks a lot @Steven and @VincentGe
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- 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...