diff --git a/reference/mongo/mongocollection/deleteindex.xml b/reference/mongo/mongocollection/deleteindex.xml index d214c6ad1e..7ae17b3297 100644 --- a/reference/mongo/mongocollection/deleteindex.xml +++ b/reference/mongo/mongocollection/deleteindex.xml @@ -13,6 +13,57 @@ public arrayMongoCollection::deleteIndex string|arraykeys + + This method is identical to: + + +toIndexString($keys); + + return $this->db->command(array("deleteIndexes" => $this->getName(), + "index" => $index); +} + +?> +]]> + + + Each index, when created, is given a unique name. This is generally user-set + (with MongoCollection::ensureIndex's "name" option) or + generated by the driver from a combination of key names and directions. This + name is then used by MongoCollection::deleteIndex to + remove the function. + + + Unfortunately, the MongoCollection::ensureIndex + generates slightly different names than the shell and, due to backwards + compatibility issues, MongoCollection::deleteIndex + cannot delete custom-named indexes as well. Thus, the best way to delete + indexes created in the shell or with custom names is to directly call the + deleteIndexes database command. + + + Thus, if you named an index "superfast query", you could delete it with: + + +command(array("deleteIndexes" => $collection->getName(), "index" => "superfast query"); + +?> +]]> + + + To find what an index is named, you can query the + system.indexes collection of a database and look for the + name field. + diff --git a/reference/mongo/mongodb.xml b/reference/mongo/mongodb.xml index 1c8db8e2f0..f489f376ef 100644 --- a/reference/mongo/mongodb.xml +++ b/reference/mongo/mongodb.xml @@ -17,8 +17,10 @@ selectDB("example"); + ?> ]]>