[cde] in MongoDB is simply a function that delivers an amiable wrapper for that usual JavaScript Date constructor. Whenever you say this in MongoDB:


You are saying exactly the same factor as:


but an individual can see an ISO 8601 date a great deal simpler compared to what they can see the amount of milliseconds since The month of january 1 1970.

So, using new Date(1320518005000); provides you with a genuine Date object within the database that you could call techniques on (for example [cde]) whilst having the ability to easily eye ball its value. Should you used a string for that date, then you would be parsing strings constantly whenever you needed to use your dates. A good example could be carrying out a map/reduce to aggregate monthly data you can parse the strings to extract the month why make use of that after use a real date object that knows what several weeks are?

Based on this source:

You will find a lot of formats available, many of them incompatible with others, that it's really a usability nightmare to select to start dating ? representation when writing to have an worldwide, mix-cultural audience, out of the box the situation on the internet. Fortunately, there's one solution within the ISO-developed worldwide date format.