Skip to content

Commit 2e0b6c6

Browse files
author
Ben Becker
committed
SERVER-9088: ensure printjson() doesn't attempt to access DB global
1 parent 5bc1180 commit 2e0b6c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mongo/shell/types.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,11 @@ tojsonObject = function(x, indent, nolint){
620620
var num = 1;
621621
for (var k in keys){
622622
var val = x[k];
623-
if (val == DB.prototype || val == DBCollection.prototype)
623+
624+
// skip internal DB types to avoid issues with interceptors
625+
if (typeof DB != 'undefined' && val == DB.prototype)
626+
continue;
627+
if (typeof DBCollection != 'undefined' && val == DBCollection.prototype)
624628
continue;
625629

626630
s += indent + "\"" + k + "\" : " + tojson(val, indent, nolint);

0 commit comments

Comments
 (0)