DB / MongoDB · January 17, 2019 0

MongoDB Get only date part of date time in project

To get only date part of date time use either substr i.e

"created_date" : {
        "$toDate" : {
          "$substr" : ['$created_at', 0, 10]
        }
      }

Or use $dateToString