Adding ISODate() for comparing dates in prisma with aggregateRaw on mongoDB

Hey guys hope you're doing all great!, I've been trying to compare dates using aggregations in mongoDB with prisma.aggregateRaw() function, in mongo compass tested this query and works well
{
$match:
{
startDate: {$gte: ISODate('2023-07-25T00:00:00.000Z')}
}
}
{
$match:
{
startDate: {$gte: ISODate('2023-07-25T00:00:00.000Z')}
}
}
when it comes down to use it with prisma the query I have is
const revResults = await prisma.reservation.aggregateRaw({
pipeline: [
{
$match: {
startDate: { $gte: formatISO(new Date('2023-07-25')) },
},
},
],
});
const revResults = await prisma.reservation.aggregateRaw({
pipeline: [
{
$match: {
startDate: { $gte: formatISO(new Date('2023-07-25')) },
},
},
],
});
tried formatting the date with formatISO from date-fns and .toISOString() but the query does not seem to work, I'm thinking it could be that I need to add the ISODate from mongodb but not quite sure how to do it with prisma, any idea helps thank u!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server