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
- Session not found. Please run appwrite l...
I have encounter an issue with appwrite CLI They asking for a login session but in the doc, it’s mention that only setup client with endpoint / api key is enou...
- SELF HOSTING ISSUE, DATA NOT MIGRATING T...
Hey, devs, I recently tried to migrate my cloud instance to a self hosted version but my data is not transferred fully only the table structure is transferred ...
- No Document ID?
Hi I have a self hosted appwrite. My documents get a document ID but are not visible in the console. I don't know why this happens and how to fix this