Returns the date as a string or Date object.
- Date () returns the current date as a string in the MONGO shell.
- new Date () returns the current date as a Date object. The MONGO shell wraps the date object as a isodate helper. Isodate in UTC.
You can specify a specific date by passing the date () method to the date () method. For example:
new Date ("<YYYY-mm-dd>") it returns ISODate的 the date of the specified date.
New Date ("<YYYY-mm-ddTHH:MM:ss>") It specifies datetime in the local datetime and returns the date of the specified datetime in UTC.
The new date ("<YYYY-mm-ddTHH:MM:ssZ>") specifies datetime in UTC and returns the isodate of the specified datetime in UTC.
If a document with ID equal to 1 does not exist in the product collection, the following action adds the current date insert to the field dateadded:
DB. Products. Update_id$setitem$setOnInsertdateaddedDateupsert})
Monogodb----Date ()