diff options
author | Aaron <aaron@10gen.com> | 2010-03-08 12:54:16 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-03-09 09:51:30 -0800 |
commit | 97515db5b80e2ca8bbdcda0158695a91dc104b22 (patch) | |
tree | f6f23ac2b747c5128ba914435904d0df5ff2bc22 | |
parent | b90ccb66528b0da2e1b18ce841359f31dcb3e7ee (diff) | |
download | mongo-97515db5b80e2ca8bbdcda0158695a91dc104b22.tar.gz |
SERVER-705 add godinsert command for testing
-rw-r--r-- | db/dbcommands.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index 92817b61349..b0a7cdd6273 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -1281,7 +1281,33 @@ namespace mongo { } distinctCmd; - + /* For testing only, not for general use */ + class GodInsert : public Command { + public: + GodInsert() : Command( "godinsert" ) { } + virtual bool logTheOp() { + return true; + } + virtual bool slaveOk() { + return false; + } + virtual LockType locktype() { return WRITE; } + virtual bool requiresAuth() { + return true; + } + virtual void help( stringstream &help ) const { + help << "[for testing only]"; + } + virtual bool run(const char *dbname, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool) { + string coll = cmdObj[ "godinsert" ].valuestrsafe(); + uassert( 13049, "godinsert must specify a collection", !coll.empty() ); + string ns = nsToDatabase( dbname ) + "." + coll; + BSONObj obj = cmdObj[ "obj" ].embeddedObjectUserCheck(); + DiskLoc loc = theDataFileMgr.insert( ns.c_str(), obj, true ); + return true; + } + } cmdGodInsert; + extern map<string,Command*> *commands; /* TODO make these all command objects -- legacy stuff here |