
OPERATIONAL DEFECT DATABASE
...

...
Can't get date value with new Date() function with mongo shell client 3.2.0 rc2. MongoDB shell version: 3.2.0-rc2 > new Date('2015-11-01 00:00:00') ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ") Which should return ISODate("2015-10-31T16:00:00Z") .
carl.dong@windfindtech.com commented on Mon, 9 Nov 2015 07:33:04 +0000: Thanks , I am going to modify the date format with "T". stennie commented on Mon, 9 Nov 2015 05:57:15 +0000: Hi Carl, Thanks for reporting! It looks like this is a parsing difference between the V8 JavaScript engine used in prior releases and the Spidermonkey engine used in MongoDB 3.2. The ECMAScript 5 Date constructor only defines support for RFC-2822 or ISO8601 date formats. The spec says that "other formats may be used, but results may be unexpected". If you use the ISO8601 formats of YYYY-MM-DD (just date) or YYYY-MM-DDThh::mm::ss (date and time) you should get the expected result. Note that ISO8601 requires a "T" as a delimiter within a date and time string: > new Date('2015-11-01') ISODate("2015-11-01T00:00:00Z") > new Date('2015-11-01T00:00:00') ISODate("2015-11-01T07:00:00Z") If you aren't able easily change the format of your date strings, as a workaround I would suggest using the ISODate() constructor in the mongo shell: > new ISODate('2015-11-01 00:00:00') ISODate("2015-11-01T00:00:00Z") The ISODate() function is a shell helper which was added to implement ISO date parsing in MongoDB before ES5-compliant JavaScript engines added support for ISO date strings in JavaScript's built-in Date() constructor. Regards, Stephen
mongo --nodb MongoDB shell version: 3.2.0-rc2 > new Date('2015-11-01 00:00:00') ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ")
Click on a version to see all relevant bugs
MongoDB Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.