[SERVER-7104] jsonString has incorrect output on undefined BSON elements. Created: 21/Sep/12  Updated: 11/Jul/16  Resolved: 25/Sep/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 2.2.2, 2.3.0

Type: Bug Priority: Minor - P4
Reporter: Shaun Verch Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-6947 db.createCollection creates undefined... Closed
is depended on by SERVER-7190 Mongodump metadata.json files should ... Closed
Related
related to SERVER-6102 Shell displays both 'undefined' and '... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

Test case that fails:

class SingleUndefinedMember {
public:
void run() {
BSONObjBuilder b;
b.appendUndefined( "a" );
ASSERT_EQUALS( "

{ \"a\" : undefined }

", b.done().jsonString( Strict ) );
}
};

jsonString outputs "

{ undefined }

"



 Comments   
Comment by auto [ 06/Nov/12 ]

Author:

{u'date': u'2012-09-21T20:08:02Z', u'email': u'shaun.verch@10gen.com', u'name': u'Shaun Verch'}

Message: SERVER-7104 Fixed handling of Undefined type in jsonString and added test cases
Branch: v2.2
https://github.com/mongodb/mongo/commit/6e3c5b7d4f3b964d2529f4fb4fa110b5f316d45f

Comment by Mathias Stearn [ 27/Sep/12 ]

This should be backported to 2.2 because it breaks the new mongodump metadata.json files. See https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/DzxWmfS6oSY for an example of the issue.

Marked as backward breaking because it changes tool output from broken to correct json. There is a tiny chance that some third-party tools will only accept the broken output while ours only accept correct output.

Comment by auto [ 25/Sep/12 ]

Author:

{u'date': u'2012-09-21T13:08:02-07:00', u'email': u'shaun.verch@10gen.com', u'name': u'Shaun Verch'}

Message: SERVER-7104 Fixed handling of Undefined type in jsonString and added test cases
Branch: master
https://github.com/mongodb/mongo/commit/924d00cee993434dd139ade27b358fbc8ce44fe2

Generated at Thu Feb 08 03:13:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.