Hi there hope you all are ok, Anyone knows whats t...
# orm-help
j
Hi there hope you all are ok, Anyone knows whats the best aproach to select by date?, I mean I want to get all entries on my mysql DB that have on date column date for example '2022-03-02' , take in mind that date is dynamic. also this date is going to be used from query params, so I want to avoid if a user writes manually on web address anything else that is not in (YYYY-MM-DD) format then dont apply that filter. These kinds of filters are pretty hard to understand at least for me, is not like on string columns that we can use contains, startswith, endswith. But on anything else that I can't find a way without using rawquery
m
Have you tried using filter conditions and operators: gt and lt
Copy code
await prisma.model.findMany({
  where: {
    createdAt: {
      gt: dateobject,
      lt: dateobject,
    },
  },
})
You might have to test this as I haven’t had a reason for this use case yet.