mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
delete one index
This commit is contained in:
parent
98623f1410
commit
cb778b072b
@ -276,7 +276,7 @@ public:
|
||||
};
|
||||
|
||||
void listen(int port) {
|
||||
cout << "db version: leapday.1 getmore fixes PATCHED.1 killcursor" << endl;
|
||||
cout << "db version: leapday.1 getmore fixes PATCHED.2 delete index" << endl;
|
||||
pdfileInit();
|
||||
testTheDb();
|
||||
cout << curTimeMillis() % 10000 << " waiting for connections...\n" << endl;
|
||||
|
31
db/query.cpp
31
db/query.cpp
@ -435,11 +435,32 @@ inline bool runCommands(const char *ns, JSObj& jsobj, stringstream& ss, BufBuild
|
||||
NamespaceDetails *d = nsdetails(toDeleteNs.c_str());
|
||||
cout << "CMD: deleteIndexes " << toDeleteNs << endl;
|
||||
if( d ) {
|
||||
ok = true;
|
||||
cout << " d->nIndexes was " << d->nIndexes << endl;
|
||||
anObjBuilderForYa.append("nIndexesWas", (double)d->nIndexes);
|
||||
cout << " temp implementation, space not reclaimed" << endl;
|
||||
d->nIndexes = 0;
|
||||
Element f = jsobj.findElement("index");
|
||||
if( !f.eoo() ) {
|
||||
// delete a specific index
|
||||
if( f.type() == String ) {
|
||||
const char *idxName = f.valuestr();
|
||||
int x = d->findIndexByName(idxName);
|
||||
if( x >= 0 ) {
|
||||
cout << " d->nIndexes was " << d->nIndexes << endl;
|
||||
anObjBuilderForYa.append("nIndexesWas", (double)d->nIndexes);
|
||||
d->nIndexes--;
|
||||
for( int i = x; i < d->nIndexes; i++ )
|
||||
d->indexes[i] = d->indexes[i+1];
|
||||
ok=true;
|
||||
cout << " alpha implementation, space not reclaimed" << endl;
|
||||
} else {
|
||||
cout << "deleteIndexes: " << idxName << " not found" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ok = true;
|
||||
cout << " d->nIndexes was " << d->nIndexes << endl;
|
||||
anObjBuilderForYa.append("nIndexesWas", (double)d->nIndexes);
|
||||
cout << " alpha implementation, space not reclaimed" << endl;
|
||||
d->nIndexes = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
anObjBuilderForYa.append("errmsg", "ns not found");
|
||||
|
Loading…
Reference in New Issue
Block a user