diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/shell_utils.cpp | 7 | ||||
-rw-r--r-- | shell/utils.js | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/shell/shell_utils.cpp b/shell/shell_utils.cpp index c3e3d2ae061..4e9a43928e2 100644 --- a/shell/shell_utils.cpp +++ b/shell/shell_utils.cpp @@ -73,11 +73,9 @@ namespace mongo { BSONObj encapsulate( const BSONObj &obj ) { return BSON( "" << obj ); } - // real methods - mongo::BSONObj JSSleep(const mongo::BSONObj &args){ assert( args.nFields() == 1 ); assert( args.firstElement().isNumber() ); @@ -181,6 +179,10 @@ namespace mongo { return BSON( "" << p.string() ); } + BSONObj hostname(const BSONObj&) { + return BSON( "" << getHostName() ); + } + BSONObj removeFile(const BSONObj& args){ uassert( 12597 , "need to specify 1 argument" , args.nFields() == 1 ); @@ -719,6 +721,7 @@ namespace mongo { scope.injectNative( "listFiles" , listFiles ); scope.injectNative( "ls" , ls ); scope.injectNative( "pwd", pwd ); + scope.injectNative( "hostname", hostname); scope.injectNative( "resetDbpath", ResetDbpath ); scope.injectNative( "copyDbpath", CopyDbpath ); #endif diff --git a/shell/utils.js b/shell/utils.js index 013847721c2..d8f84120232 100644 --- a/shell/utils.js +++ b/shell/utils.js @@ -810,8 +810,10 @@ help = shellHelper.help = function (x) { print("\tls([path]) list files");
print("\tpwd() returns current directory");
print("\tlistFiles([path]) returns file list");
+ print("\thostname() returns name of this host");
print("\tremoveFile(f) delete a file");
print("\tload(jsfilename) load and execute a .js file");
+ print("\tsleep(m) sleep m milliseconds");
return;
}
if (x == "test") {
@@ -824,6 +826,7 @@ help = shellHelper.help = function (x) { print("\t returns a connection to the new server");
return;
}
+ print("\t" + "help admin misc shell commands");
print("\t" + "show dbs show database names");
print("\t" + "show collections show collections in current database");
print("\t" + "show users show users in current database");
@@ -834,7 +837,6 @@ help = shellHelper.help = function (x) { print("\t" + "db.foo.find() list objects in collection foo");
print("\t" + "db.foo.find( { a : 1 } ) list objects in foo where a == 1");
print("\t" + "it result of the last line evaluated; use to further iterate");
- print("\t" + "help admin misc shell commands");
print("\t" + "exit quit the mongo shell");
} |