|
MongoCollection::deleteIndex(PECL mongo >=0.9.0) MongoCollection::deleteIndex — Deletes an index from this collection Описание
public array MongoCollection::deleteIndex
( string|array $keys
)
This method is identical to:
<?php 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 only delete it with the PHP driver by running:
<?php To find what an index is named, you can query the system.indexes collection of a database and look for the name field. Список параметров
Возвращаемые значенияReturns the generated name of the key if successful, or NULL otherwise. ПримерыПример #1 MongoCollection::deleteIndex() example This example passes the function string and array parameters.
<?php |
|