summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-03-08 12:54:16 -0800
committerAaron <aaron@10gen.com>2010-03-09 09:51:30 -0800
commit97515db5b80e2ca8bbdcda0158695a91dc104b22 (patch)
treef6f23ac2b747c5128ba914435904d0df5ff2bc22
parentb90ccb66528b0da2e1b18ce841359f31dcb3e7ee (diff)
downloadmongo-97515db5b80e2ca8bbdcda0158695a91dc104b22.tar.gz
SERVER-705 add godinsert command for testing
-rw-r--r--db/dbcommands.cpp28
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