1

I want to execute the following code using Metabase and MongoDB database:

[{
  "$project":{
    "incrementId":"$incrementId",
    "createdAt":"$createdAt"
  }
},
  {"$limit":1048576}
]

How do I select a specific date? Let's say i want to see results for 18.03.2021. I'd really appreciate any advice.

Omkar Kulkarni
  • 1,091
  • 10
  • 22

2 Answers2

0

Try this one:

{
   $match: {
      createdAt: {
         $gte: ISODate("2021-03-18T00:00:00Z"),
         $lte: ISODate("2021-03-18T23:59:59.999Z"),
      }
   }
}
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
0

This should work

[
  {
    $match: { createdAt: {
      '$gte': ISODate("2019-11-21T00:00:40.294Z"),
      '$lt': ISODate("2019-11-21T25:59:59")
    }}
  },
  {
    "$project":{
      "incrementId":"$incrementId",
      "createdAt":"$createdAt"
    }
  },
    {"$limit":1048576}
]
Omkar Kulkarni
  • 1,091
  • 10
  • 22