Data atual em MongoDB
1. Date() returns the current date as a string in mongosh.
2. new Date() returns the current date as a Date object
db.products.updateOne(
{ _id: 1 },
{
$set: { item: "apple" },
$setOnInsert: { dateAdded: new Date() }
},
{ upsert: true }
)
Tiny Coders