summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-03-26 16:16:53 -0400
committerEliot Horowitz <eliot@10gen.com>2009-03-26 16:16:53 -0400
commitc4c2b2559a94d4fe0859c6a25aea5c994b39e6f2 (patch)
tree495b545a082c10dc6873d17b3324626aeefdab3a /shell
parent711ff204f2c1341fb0373ffc1368c22f7b707b80 (diff)
downloadmongo-c4c2b2559a94d4fe0859c6a25aea5c994b39e6f2.tar.gz
better Array.tojson option
Diffstat (limited to 'shell')
-rw-r--r--shell/utils.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/shell/utils.js b/shell/utils.js
index c4c8f40d646..59ab16fd7cd 100644
--- a/shell/utils.js
+++ b/shell/utils.js
@@ -115,14 +115,18 @@ Date.prototype.tojson = function(){
RegExp.prototype.tojson = RegExp.prototype.toString;
-Array.prototype.tojson = function(){
+Array.prototype.tojson = function( sepLines ){
var s = "[";
+ if ( sepLines ) s += "\n";
for ( var i=0; i<this.length; i++){
- if ( i > 0 )
+ if ( i > 0 ){
s += ",";
+ if ( sepLines ) s += "\n";
+ }
s += tojson( this[i] );
}
s += "]";
+ if ( sepLines ) s += "\n";
return s;
}