Monogodb----Date ()

Source: Internet
Author: User

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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.