Cant between filter collection with a dateTime attribute?
const query = [Query.between("dateTimeAttribute", "ISOString", "ISOString")]
Currently I'm getting the error Query not valid: Query type does not match expected: datetime.
I'm confusing if the errors refers to isn't possible to query datetime attributes, or the value sen't isn't right
I've just tests it Can you share the full ISOString you've send?
I've send something like this
const query = [
Query.between('date','2022-08-17T00:03:13.182Z','2024-08-17T00:03:13.182Z');
]
And it gave me indeed anything in between
The full ISO string is this:
const start = "2023-08-15T04:00:13.989Z";
const end = "2023-08-15T07:00:21.100Z";
Query.between("date", start, end);
when I print the query, it looks like this: between("date", ["2023-08-15T04:00:13.989Z","2023-08-15T07:00:21.100Z"])
I don't see what is wrong 🤔
It should work
It's interesting that the query put the values into arrays
Can you try this
const query = [
...
`between("data", "2023-08-15T04:00:13.989Z","2023-08-15T07:00:21.100Z")`,
]
This way we try to force it to use 3 parameters one
Yes, that solved the problem.
Seems like there is a bug in the library: https://github.com/appwrite/sdk-for-web/blob/master/src/query.ts#L31
I'll create an issue
I think it has to do with all other SDKs
I saw it in other
You mean in others sdk it's working?
No, They have the bug as well
Oh, yes I saw it in the sdk generator repo and it's the same for all
Exactly
The problem seems to be here
static addQuery = (attribute, method, value) =>
value instanceof Array
? `${method}("${attribute}", [${value
.map((v) => Query.parseValues(v))
.join(",")}])`
: `${method}("${attribute}", [${Query.parseValues(value)}])`;
It always parse the values as string array
Yes, and in Utopia-PHP database module it seems like it should be change either to array or to the fix you've suggested
https://github.com/utopia-php/database/blob/main/src/Database/Query.php#L350
I think isn't possible to make a change in the SDK repo, as there are cases like when you send multiples values in an array, so in theory the query is valid. The problem is the between method
[CLOSED] Query.between
Recommended threads
- Appwrite console is too heavy
The Appwrite console is too heavy And all of my services broken Any support , please
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- Increase by operators
I see appwrite have bunch of useful operators for querieng db. One more I would like to suggest is operators like increase the count of a int columns by 1,2.. ...