[DOCS-3879] Change in mongoexport output format for dates Created: 07/Aug/14  Updated: 30/Apr/15  Resolved: 12/Sep/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: mongodb-2.6
Fix Version/s: v1.3.11, mongodb-2.6

Type: Bug Priority: Major - P3
Reporter: Matt Kangas Assignee: Andrew Aldridge
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-2539 Document ISODate support in JSON parser Closed
is related to JAVA-1354 JSON date parsing fails with timezone... Closed
is related to SERVER-11813 In strict-json mode, represent dates ... Closed
Participants:
Days since reply: 8 years, 41 weeks, 6 days ago

 Description   

SERVER-11813 changed the output format for BSON date values in strict-json. This was introduced in 2.5.5.

This means that mongoexport in 2.6 now produces different output for date values.

$ /mongodb-2.2.default/bin/mongoexport -d test -c test
{ "_id" : { "$date" : 1407433938490 } }
 
$ /mongodb-2.4.default/bin/mongoexport -d test -c test
{ "_id" : { "$date" : 1407433938490 } }
 
$ /mongodb-2.6.default/bin/mongoexport -d test -c test
{ "_id" : { "$date" : "2014-08-07T13:52:18.490-0400" } }

The value is ISO-8601 format using the local timezone of the system mongoexport is running on. We failed to document this change for the 2.6 release. This is a breaking change to any programs that were consuming the output of mongoexport.

Related parsing changes: DOCS-2539



 Comments   
Comment by Ethan Lacey [ 30/Apr/15 ]

It's a fair question, does 2.6 or 3.0 offer the ability to retain backwards compatibility with 2.4 date formats? As you would guess, any large scale data integration is driven by a dump, not API, which this breaks.

Comment by Michael Paik [ 30/Mar/15 ]

cgopalan@sailthru.com, to make that feature request you'll need to open a server tools ticket under the TOOLS project.

Comment by Chandrakant Gopalan [ 26/Mar/15 ]

Hello,
Since this is a breaking change, is there a way to specify a flag to mongoexport that will keep the date output the same as 2.4?

Thanks
Chandrakant

Comment by Githook User [ 12/Sep/14 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-3879: edits
Branch: master
https://github.com/mongodb/docs/commit/67d6d668a5dfa8518a5d378f635e54b4759d2f77

Comment by Githook User [ 12/Sep/14 ]

Author:

{u'username': u'i80and', u'name': u'Andrew Aldridge', u'email': u'i80and@foxquill.com'}

Message: DOCS-3879: Document changes for 2.6 in date formatting

Signed-off-by: Sam Kleinman <samk@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/3e1dee0365da66e3e153c45d8a3080a3af55009c

Comment by Frej Bjon [ 08/Aug/14 ]

To point out a related effect, the behaviour is different for pre-1970 dates:

"pre-epoch" : {
	"$date" : {
		"$numberLong" : "-1"
	}
},
"epoch" : {
	"$date" : "1970-01-01T02:00:00.000+0200"
}

Comment by Jeffrey Yemin [ 07/Aug/14 ]

Also note that this change effectively alters the specification for MongoDB Extended JSON Format, which states that the value of $date is an Int64: http://docs.mongodb.org/manual/reference/mongodb-extended-json/#date

Generated at Thu Feb 08 07:46:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.