-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need ability to query for null values (or filter for non-null values) in collections #2680
Comments
Anything further on this one? If I'm not mistaken, as late as 14.2, if you add a boolean attribute to a collection without setting default, then the value of existing documents already in the collection is null for that attribute. I tried applying [attr].notEqual(true), and that didn't appear to do it. |
+1 |
+1 |
If you will not be providing the ability to query by equality to |
@ddenev, it makes sense to be able to have an empty string be a default. Since it seems like this might be an unrelated bug, would you be able to create a new issue for it? |
@stnguyen90, I'm not sure this is a bug. Here is why:
So it seems rather deliberate and also I believe it's OK to work that way, i.e. to have We just need the additional option to be able to specify the empty string as default. Currently you have only a single text input field and when it's empty, you assume
and when the user selects the 'Text' radio then allow entering text in a text input field (in this case when empty, assume the empty string) That's it - simple :) |
@ddenev, I tested by creating an attribute with default as |
@stnguyen90, sorry, could you clarify? Are you inputting |
@ddenev, not putting anything at all. When inspecting the network request, you'll see that an empty string is sent for the default parameter. |
Dear @eldadfux I consider null values in the DB to be valid carriers of business information - e.g. I use null values to explicitly express "no value". Therefore I have a number of documents with null attributes which I need to query. The lack of Therefore, do you plan to add this to Appwrite? Thank you! |
I'd like to add my voice to this. Query.equal('attributeName', null) does not seem to work so we are having to resort to horrible kludges. NULL is different than 0 or an empty string, we need to be able to query for it. To my mind, making it explicit with something like |
+1 |
I'd also like to add my voice to this, as it's becoming a major headache for me. Due to the way that I have to deal with indexes, this issue means that any attribute that is (and should be/needs to be) empty, or an empty string, gets excluded from a query. Even if I go with workarounds for default placeholder values e.g. defaulting to a value of "-" or something similar, this use case allows the user to edit the field (e.g. a text attribute of notes, that could easily be empty), so it could easily be changed back to an empty string. I'd really rather avoid having to check every field entry for an empty string and replace it on the client side just so that documents can continue to be correctly queried. Is this going to be given any priority? It's becoming a serious usability issue the further I go in developing these advanced query structures. |
+1 |
This feature will be added in the next release. |
@eldadfux let us know when this feature has been released |
When I do AppwriteException [Error]: Invalid query: Query type does not match expected: string. |
@HasanAboShally Wouldn't you need to use the isNull query? Is Null | Query.isNull("name") | Returns documents where attribute value is null.
Is Not Null | Query.isNotNull("name") | Returns documents where attribute value is not null. |
When creating collections, some attributes are bound to be optional (not all attributes can be required). By neglect or error, null values will thus find their way into collections via optional attributes. The only "sure way" to avoid this is to define default values for all optional attributes. BUT, sooner or later, Murphy will enter the picture and null values will appear! Either a line of code will forget an optional attribute or a backup/restore procedure will or some legacy collection already has null value(s)! After all, like me, some users may not have been aware of the fact that null values are out of bounds for queries -- some may still be unaware. They may (still) be operating under the assumption null values can be queried/filtered (and filled) programmatically. When they discover the truth, it may be too late! So, please consider providing a way to query for null values in the next PA release of AW.
Thanks!
TBT
Appwrite Version: 0.12.1.201
The text was updated successfully, but these errors were encountered: