summaryrefslogtreecommitdiff
path: root/db/dbcommands.cpp
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2009-09-01 16:23:56 -0400
committerDwight <dmerriman@gmail.com>2009-09-01 16:23:56 -0400
commit7172529835487de9dec84e03c5eea4c2d065a621 (patch)
tree1cebf3643ef3a641b51b82744dae49811a731992 /db/dbcommands.cpp
parent777c1883c3d019e1318703eb324fa55dff325ad8 (diff)
downloadmongo-7172529835487de9dec84e03c5eea4c2d065a621.tar.gz
some help for commands
Diffstat (limited to 'db/dbcommands.cpp')
-rw-r--r--db/dbcommands.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp
index b6f68c368c1..9b6a44656df 100644
--- a/db/dbcommands.cpp
+++ b/db/dbcommands.cpp
@@ -209,6 +209,9 @@ namespace mongo {
virtual bool slaveOk() {
return true;
}
+ virtual void help( stringstream& help ) const {
+ help << "shutdown the database. must be ran against admin db and either (1) ran from localhost or (2) authenticated.\n";
+ }
CmdShutdown() : Command("shutdown") {}
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( noauth ) {
@@ -241,6 +244,9 @@ namespace mongo {
virtual bool slaveOk() {
return true;
}
+ virtual void help( stringstream& help ) const {
+ help << "reset error state (used with getpreverror)";
+ }
CmdResetError() : Command("reseterror") {}
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
LastError *le = lastError.get();
@@ -259,6 +265,9 @@ namespace mongo {
virtual bool slaveOk() {
return true;
}
+ virtual void help( stringstream& help ) const {
+ help << "return error status of the last operation";
+ }
CmdGetLastError() : Command("getlasterror") {}
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
LastError *le = lastError.get();
@@ -294,6 +303,9 @@ namespace mongo {
virtual bool logTheOp() {
return false;
}
+ virtual void help( stringstream& help ) const {
+ help << "check for errors since last reseterror commandcal";
+ }
virtual bool slaveOk() {
return true;
}
@@ -316,6 +328,9 @@ namespace mongo {
virtual bool logTheOp() {
return true;
}
+ virtual void help( stringstream& help ) const {
+ help << "drop (delete) this database";
+ }
virtual bool slaveOk() {
return false;
}
@@ -339,6 +354,9 @@ namespace mongo {
virtual bool slaveOk() {
return true;
}
+ virtual void help( stringstream& help ) const {
+ help << "repair database. also compacts. note: slow.";
+ }
CmdRepairDatabase() : Command("repairDatabase") {}
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
BSONElement e = cmdObj.findElement(name);
@@ -363,6 +381,9 @@ namespace mongo {
virtual bool slaveOk() {
return true;
}
+ virtual void help( stringstream& help ) const {
+ help << "enable or disable performance profiling";
+ }
CmdProfile() : Command("profile") {}
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
BSONElement e = cmdObj.findElement(name);
@@ -441,6 +462,9 @@ namespace mongo {
virtual bool slaveOk() {
return true;
}
+ virtual void help( stringstream& help ) const {
+ help << "check if any asserts have occurred on the server";
+ }
CmdAssertInfo() : Command("assertinfo") {}
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
result.appendBool("dbasserted", lastAssert[0].isSet() || lastAssert[1].isSet() || lastAssert[2].isSet());
@@ -678,6 +702,9 @@ namespace mongo {
virtual bool adminOnly() {
return false;
}
+ virtual void help( stringstream& help ) const {
+ help << "create a collection";
+ }
virtual bool run(const char *_ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool) {
string ns = database->name + '.' + cmdObj.findElement(name).valuestr();
string err;
@@ -696,6 +723,9 @@ namespace mongo {
virtual bool slaveOk() {
return false;
}
+ virtual void help( stringstream& help ) const {
+ help << "delete indexes for a collection";
+ }
CmdDeleteIndexes() : Command("deleteIndexes") { }
bool run(const char *ns, BSONObj& jsobj, string& errmsg, BSONObjBuilder& anObjBuilder, bool /*fromRepl*/) {
/* note: temp implementation. space not reclaimed! */