diff options
author | Mathias Stearn <mathias@10gen.com> | 2011-03-29 20:20:04 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2011-03-29 20:52:53 -0400 |
commit | 30dd944c47d84482880387ce82bbebe65a79ed9f (patch) | |
tree | ffdd84b0b47a608b455b3abfce314b5140f24ff6 /shell | |
parent | 0584a5ee577587b90b7cafb5c86cb13d6322cc3c (diff) | |
download | mongo-30dd944c47d84482880387ce82bbebe65a79ed9f.tar.gz |
validate command now puts all data in proper fields SERVER-2849
Diffstat (limited to 'shell')
-rw-r--r-- | shell/collection.js | 22 | ||||
-rw-r--r-- | shell/mongo_vstudio.cpp | 4 |
2 files changed, 17 insertions, 9 deletions
diff --git a/shell/collection.js b/shell/collection.js index 350276f1cb0..eb47a48dd1b 100644 --- a/shell/collection.js +++ b/shell/collection.js @@ -384,18 +384,22 @@ DBCollection.prototype.validate = function(full) { var res = this._db.runCommand( cmd ); - res.valid = false; + if (typeof(res.valid) == undefined) { + // old-style format just put everything in a string. Now using proper fields - var raw = res.result || res.raw; + res.valid = false; - if ( raw ){ - var str = "-" + tojson( raw ); - res.valid = ! ( str.match( /exception/ ) || str.match( /corrupt/ ) ); + var raw = res.result || res.raw; - var p = /lastExtentSize:(\d+)/; - var r = p.exec( str ); - if ( r ){ - res.lastExtentSize = Number( r[1] ); + if ( raw ){ + var str = "-" + tojson( raw ); + res.valid = ! ( str.match( /exception/ ) || str.match( /corrupt/ ) ); + + var p = /lastExtentSize:(\d+)/; + var r = p.exec( str ); + if ( r ){ + res.lastExtentSize = Number( r[1] ); + } } } diff --git a/shell/mongo_vstudio.cpp b/shell/mongo_vstudio.cpp index 6848a96f57e..7947f81ca45 100644 --- a/shell/mongo_vstudio.cpp +++ b/shell/mongo_vstudio.cpp @@ -3185,6 +3185,9 @@ const StringData _jscode_raw_collection = "\n" "var res = this._db.runCommand( cmd );\n" "\n" +"if (typeof(res.valid) == undefined) {\n" +"// old-style format just put everything in a string. Now using proper fields\n" +"\n" "res.valid = false;\n" "\n" "var raw = res.result || res.raw;\n" @@ -3199,6 +3202,7 @@ const StringData _jscode_raw_collection = "res.lastExtentSize = Number( r[1] );\n" "}\n" "}\n" +"}\n" "\n" "return res;\n" "}\n" |