Hello, I have been trying to list documents containing the following query:
const min = (+val.minimum).toFixed(2) // ex. "51.23"
const max = (+val.maximum).toFixed(2) // ex. "82.12"
const result = await this.database.listDocuments(
db.databaseId,
Collection.IMAGES,
[
Query.greaterThanEqual("score", min),
Query.lessThanEqual("score", max),
]
);```
but I keep getting the following response error:
```json
{
"message": "Query not valid: Query type does not match expected: double",
"code": 400,
"type": "general_argument_invalid",
"version": "1.2.0"
}```
the score attribute is a Float Attribute in the db
what is the correct way to query for double with appwrite?
Weird...this seems fine...are you able to see what's sent in the network request?
yup, here's what the raw payload looks like: queries%5B0%5D=greaterThanEqual%28%22score%22%2C+%5B%2251.23%22%5D%29&queries%5B1%5D=lessThanEqual%28%22score%22%2C+%5B%2292.12%22%5D%29&queries%5B2%5D=orderDesc%28%22score%22%29
heres how it looks decoded: queries[0]: greaterThanEqual("score", ["51.23"]) queries[1]: lessThanEqual("score", ["92.12"]) queries[2]: orderDesc("score")
seems like this is related to this issue: https://github.com/appwrite/appwrite/issues/4340
That issue is for passing integers but you're passing decimal numbers
Can you try to not use double quotes around the numbers?
this one worked lol, thank you!
but still for integers i would have to do a workaround like if the value is 50 - then i would just subtract 0.1 from it
[SOLVED] How to Query for Double Attribute
Yes, hopefully, the fix will be in the next release
Recommended threads
- Site deployment keeps getting failed
Hi good folks, need a hand with Sites deploy Error on every deploy: Synchronous function execution timed out... duration doesn't exceed 30 seconds [exact log ...
- Relation Question
How do I create a relation from table y to an others x.$id. in my example I have a users table where I use Appwrites unique User IDs and I want other tables fo...
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...