update msvc shell file

This commit is contained in:
Dwight
2010-10-14 13:32:40 -04:00
parent 3140bef60c
commit 52fc08fb5d
4 changed files with 26 additions and 16 deletions

View File

@@ -1061,34 +1061,45 @@ const StringData _jscode_raw_utils =
"shellPrintHelper( ___it___ );\n"
"}\n"
"\n"
"shellHelper.show = function( what ){\n"
"assert( typeof what == \"string\" );\n"
"shellHelper.show = function (what) {\n"
"assert(typeof what == \"string\");\n"
"\n"
"if( what == \"profile\" ) {\n"
"if( db.system.profile.count() == 0 ) {\n"
"if (what == \"profile\") {\n"
"if (db.system.profile.count() == 0) {\n"
"print(\"db.system.profile is empty\");\n"
"print(\"Use db.setProfilingLevel(2) will enable profiling\");\n"
"print(\"Use db.system.profile.find() to show raw profile entries\");\n"
"}\n"
"else {\n"
"print();\n"
"db.system.profile.find({ millis : { $gt : 0 } }).sort({$natural:-1}).limit(5).forEach( function(x){print(\"\"+x.millis+\"ms \" + String(x.ts).substring(0,24)); print(x.info); print(\"\\n\");} )\n"
"db.system.profile.find({ millis: { $gt: 0} }).sort({ $natural: -1 }).limit(5).forEach(function (x) { print(\"\" + x.millis + \"ms \" + String(x.ts).substring(0, 24)); print(x.info); print(\"\\n\"); })\n"
"}\n"
"return \"\";\n"
"}\n"
"\n"
"if ( what == \"users\" ){\n"
"db.system.users.find().forEach( printjson );\n"
"if (what == \"users\") {\n"
"db.system.users.find().forEach(printjson);\n"
"return \"\";\n"
"}\n"
"\n"
"if ( what == \"collections\" || what == \"tables\" ) {\n"
"db.getCollectionNames().forEach( function(x){print(x)} );\n"
"if (what == \"collections\" || what == \"tables\") {\n"
"db.getCollectionNames().forEach(function (x) { print(x) });\n"
"return \"\";\n"
"}\n"
"\n"
"if ( what == \"dbs\" ) {\n"
"db.getMongo().getDBNames().sort().forEach( function(x){print(x)} );\n"
"if (what == \"dbs\") {\n"
"var dbs = db.getMongo().getDBs();\n"
"var size = {};\n"
"dbs.databases.forEach(function (x) { size[x.name] = x.sizeOnDisk; });\n"
"var names = dbs.databases.map(function (z) { return z.name; }).sort();\n"
"names.forEach(function (n) {\n"
"if (size[n] > 1) {\n"
"print(n + \"\\t\" + size[n] / 1024 / 1024 / 1024 + \"GB\");\n"
"} else {\n"
"print(n + \"\\t(empty)\");\n"
"}\n"
"});\n"
"//db.getMongo().getDBNames().sort().forEach(function (x) { print(x) });\n"
"return \"\";\n"
"}\n"
"\n"