Also, is there a way to return datetime objects fr...
# mongodb
d
Also, is there a way to return datetime objects from a query as strings instead of
{ $date: 'xxx' }
values?
e
You can do this in the
$project
stage using
$dateToString
e.g.
Copy code
{
  $project: {
    createdAt: { $dateToString: { date: '$createdAt' } },
    updatedAt: { $dateToString: { date: '$updatedAt' } },
  }
}
d
Cool, thank you!
👍🏿 1