[SERVER-9088] printjson/printjsononeline JS helpers may attempt to access the 'DB' object (even if it doesn't exist) Created: 22/Mar/13  Updated: 11/Jul/16  Resolved: 25/Mar/13

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 2.4.0, 2.4.1
Fix Version/s: 2.4.2, 2.5.0

Type: Bug Priority: Major - P3
Reporter: Ben Becker Assignee: Ben Becker
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

This means that printjson() may not work in $where queries or MapReduce jobs.



 Comments   
Comment by auto [ 28/Mar/13 ]

Author:

{u'date': u'2013-03-25T20:54:36Z', u'name': u'Ben Becker', u'email': u'ben.becker@10gen.com'}

Message: SERVER-9088: ensure printjson() doesn't attempt to access DB global
Branch: v2.4
https://github.com/mongodb/mongo/commit/f9289144fce80aee078213c4553015bf49954d91

Comment by Andy O'Neill [ 26/Mar/13 ]

Confirmed that this breaks tojson() in MapReduce code. I'm only commenting here because google doesn't know anything about this error yet, this may save someone an afternoon tracking a bug that is fixed in 2.4.2.

This is the error message that is caused by this bug:

com.mongodb.CommandResult$CommandFailure: command failed [mapreduce]: { "serverUsed" : "qa-2/127.0.0.1:27017" , "errmsg" : "exception: JavaScript execution failed: ReferenceError: DB is not defined at src/mongo/shell/types.js:L603" , "code" : 16722 , "ok" : 0.0}

Comment by auto [ 25/Mar/13 ]

Author:

{u'date': u'2013-03-25T20:54:36Z', u'name': u'Ben Becker', u'email': u'ben.becker@10gen.com'}

Message: SERVER-9088: ensure printjson() doesn't attempt to access DB global
Branch: master
https://github.com/mongodb/mongo/commit/2e0b6c68eb6bc7caabe4494ff79263d17a5202a0

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