diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-10-19 11:00:43 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-10-19 11:00:43 -0400 |
commit | f81362eb25768db22911ed577a0364c3863fb52c (patch) | |
tree | da8b32b2e8e7eed7f4716f85f7343e92f509f8a1 /shell/utils.js | |
parent | 529167b0f5d5cf0d8d1df71d28f4a6265a9f1c8f (diff) | |
download | mongo-f81362eb25768db22911ed577a0364c3863fb52c.tar.gz |
some tojson nicities
Diffstat (limited to 'shell/utils.js')
-rw-r--r-- | shell/utils.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/utils.js b/shell/utils.js index 7035810cd43..f11186382e4 100644 --- a/shell/utils.js +++ b/shell/utils.js @@ -347,7 +347,7 @@ tojson = function( x, indent , nolint ){ case "object":{ var s = tojsonObject( x, indent , nolint ); - if ( ( nolint == null || nolint == true ) && s.length < 70 && ( indent == null || indent.length == 0 ) ){ + if ( ( nolint == null || nolint == true ) && s.length < 80 && ( indent == null || indent.length == 0 ) ){ s = s.replace( /[\s\r\n ]+/gm , " " ); } return s; @@ -396,9 +396,12 @@ tojsonObject = function( x, indent , nolint ){ s += indent + lineEnding; } + var keys = x; + if ( typeof( x._simpleKeys ) == "function" ) + keys = x._simpleKeys(); var num = 1; - for ( var k in x ){ - + for ( var k in keys ){ + var val = x[k]; if ( val == DB.prototype || val == DBCollection.prototype ) continue; |