In MongoDB, the $currentDate
operator sets the value of a field to the current date.
It can be set as either a Date or a timestamp type. The default is Date.
$currentDate
is an update operator, and can only be used when updating documents, not when inserting them (although it can be used in upsert operations).