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
- Urgent help with removed databases
Hi <@564158268319203348> <@501784879638249472> I wrote to paid plan support about this but no response as of yet… About an hour ago one of the interns from o...
- MariaDB refuses to connect to appwrite
Earlier, I tried updating my Appwrite version from 18.1.x to the latest release because my Flutter package required it to function properly. I used the official...
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...