TypeScript
const oneDayAgo = new Date();
oneDayAgo.setDate(oneDayAgo.getDate() - 1);
const result=await database.listDocuments(databaseid, collectionId,[
Query.limit(50),
Query.orderDesc("$createdAt"),
Query.greaterThan("$createdAt",oneDayAgo),
Query.lessThan("$createdAt",today)
])
TL;DR
Developers are trying to fetch data from one day before, but the code is resulting in a server error. The issue may be with how the date is being handled. One suggestion is to use .toISOString(), and another idea is to check if the code works without queries.Please explain more what your issue is, what errors do you have? Is there anything else we need to know?
it says server error
So a 500 I'm guessing. Can you try without queries and see if that works?
yes its not working after Query.greaterThan("$createdAt",oneDayAgo)
what does oneDayAgo variable result in?
its return a date
try using .toISOString()
Recommended threads
- Cant get realtime working
Hey I nned some help with realtime a gain. I was using client.subscribe(...), and i found out that its depricated then i believe realtime.subscribe(...) is the ...
- Hi Folks, Database Writing Issue
Hey Folks im trying to get logging setup on my website but im getting an error, i dont have any document id and i think this is the issue but i havent got the f...
- Middleware
how to make middleware in nextjs appwrite with client side auth?