how should I go for writing a query for findMany w...
# orm-help
a
how should I go for writing a query for findMany where I want to find rows where one DateTime property is 30 days old (or older)? not sure if I should use something like
gte
or
lte
or what I should input there
1
j
a
the problem is that that one uses hardcoded dates, I need it to use the date from the row itself
for example for a
createdAt
column (with the DateTime of the time it was created), I'd like to fetch queries that are 30 days old
j
Did you try
toDate
from date-fns to get the data?
a
the
createdAt
column already uses DateTime, I'm more wondering if there's a way to fetch that with a single query or can I only fetch them all at once and manually filter the array
j
I understand your point so could you please try
toDate
from date-fns to filter it?
If it does not work I think should use raw database access https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access
a
sorry I don't think I quite got yours then, I looked `toDate`'s documentation but I didn't quite see what I would use of it, from what I understood it just clones the date
j
So I think you should try raw database access
a
will use raw then, thanks! prisma cool
prisma cool 1