Are mongodb ids unique ?

MongoDB Date format

Date() : According to the MongoDB, date can be returns a string or object.

Two Types
1.      Date()
2.      new Date()

The Date() method is returns the current date as a string.

For example, var date = Date();  //return date as a string

The above date variable returns current date as a string.

The new Date() method returns the current date as a Date object.

You can specify different types of date format:

1.      new Date("YYYY-mm-dd")
2.      new Date("YYYY-mm-ddTHH:MM:ss")
3.      new Date("YYYY-mm-ddTHH:MM:ssZ")

For example, var date = new Date ("2016-07-26T14:59:00Z"); //return date as date object

The above date variable returns date as a date object.  

How to use date in MongoDD query?

{ _id: 1001 },  
{ $set: { name: "Anil" },    $setOnInsert: { UpdatedDate: new Date() }   },  
{ upsert: true }


Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog -
My Books - Book 1 and Book 2

MongoDB Date format MongoDB Date format Reviewed by Anil Singh on 2:46 AM Rating: (5) Powered by Blogger.