Mongo db query: get records created today

How can I get records created today?

Looks like I can't use new Date() here...

@_andrew

Hey there, it looks like you are not currently using {{ }} around

{{ (new Date()).setHours(0,0,0,0) }}

Hope that helps!

1 Like

That helped a lot!

Here's my final code:

{
  "created_at": {
    "$gte": { $date : {{ moment().startOf('day') }} }
  }
}