python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
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?

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


ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions