0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-693 don't duplicate db name when creating collection

This commit is contained in:
Aaron 2010-03-02 16:21:51 -08:00
parent e03392121b
commit 00684b8c1b
2 changed files with 13 additions and 2 deletions

View File

@ -233,11 +233,11 @@ namespace mongo {
BSONObj o;
if ( info == 0 ) info = &o;
BSONObjBuilder b;
b.append("create", ns);
string db = nsToDatabase(ns.c_str());
b.append("create", ns.c_str() + db.length() + 1);
if ( size ) b.append("size", size);
if ( capped ) b.append("capped", true);
if ( max ) b.append("max", max);
string db = nsToDatabase(ns.c_str());
return runCommand(db.c_str(), b.done(), *info);
}

View File

@ -144,6 +144,16 @@ namespace ClientTests {
}
};
class Create : public Base {
public:
Create() : Base( "Create" ) {}
void run() {
db.createCollection( "unittests.clienttests.create", 0, true );
BSONObj info;
ASSERT( db.runCommand( "unittests", BSON( "collstats" << "clienttests.create" ), info ) );
}
};
class All : public Suite {
public:
All() : Suite( "client" ){
@ -155,6 +165,7 @@ namespace ClientTests {
add<ReIndex2>();
add<CS_10>();
add<PushBack>();
add<Create>();
}
} all;