MONGOCOLLECTION.DELETEINDEXES(3) 1 MONGOCOLLECTION.DELETEINDEXES(3)MongoCollection::deleteIndexes - Delete all indices for this collection
SYNOPSIS
public array MongoCollection::deleteIndexes (void )
DESCRIPTION PARAMETERS
This function has no parameters.
RETURN VALUES
Returns the database response.
EXAMPLES
Example #1
MongoCollection.deleteIndexes(3) example
This example demonstrates how to delete all indexes from a collection and the response to expect.
<?php
$collection = $mongo->my_db->articles;
$response = $collection->deleteIndexes();
print_r($response);
?>
The above example will output something similar to:
Array
(
[nIndexesWas] => 1
[msg] => all indexes deleted for collection
[ok] => 1
)
SEE ALSO
MongoCollection::createIndex, MongoCollection::deleteIndex.
PHP Documentation Group MONGOCOLLECTION.DELETEINDEXES(3)
Check Out this Related Man Page
MONGOCOLLECTION(3) 1 MONGOCOLLECTION(3)The MongoCollection classINTRODUCTION
Represents a MongoDB collection.
Collection names can use any character in the ASCII set. Some valid collection names are "", "...", "my collection", and "*&#@".
User-defined collection names cannot contain the $ symbol. There are certain system collections which use a $ in their names (e.g.,
local.oplog.$main), but it is a reserved character. If you attempt to create and use a collection with a $ in the name, MongoDB will
assert.
CLASS SYNOPSIS
MongoCollection
MongoCollection
Constants
o const int$MongoCollection::ASCENDING1
o const int$MongoCollection::DESCENDING-1
Fields
o public MongoDB$db NULL
o public integer$w
o public integer$wtimeout
Methods
o public array MongoCollection::aggregate (array $pipeline, [array $options])
o public MongoCommandCursor MongoCollection::aggregateCursor (array $command, [array $options])
o public mixed MongoCollection::batchInsert (array $a, [array $options = array()])
o public MongoCollection::__construct (MongoDB $db, string $name)
o public int MongoCollection::count ([array $query = array()], [array $options = array()])
o public array MongoCollection::createDBRef (mixed $document_or_id)
o public bool MongoCollection::createIndex (array $keys, [array $options = array()])
o public array MongoCollection::deleteIndex (string|array $keys)
o public array MongoCollection::deleteIndexes (void )
o public array MongoCollection::distinct (string $key, [array $query])
o public array MongoCollection::drop (void )
o public bool MongoCollection::ensureIndex (string|array $key|keys, [array $options = array()])
o public MongoCursor MongoCollection::find ([array $query = array()], [array $fields = array()])
o public array MongoCollection::findAndModify (array $query, [array $update], [array $fields], [array $options])
o public array MongoCollection::findOne ([array $query = array()], [array $fields = array()], [array $options = array()])
o public MongoCollection MongoCollection::__get (string $name)
o public array MongoCollection::getDBRef (array $ref)
o public array MongoCollection::getIndexInfo (void )
o public string MongoCollection::getName (void )
o public array MongoCollection::getReadPreference (void )
o public bool MongoCollection::getSlaveOkay (void )
o public array MongoCollection::getWriteConcern (void )
o public array MongoCollection::group (mixed $keys, array $initial, MongoCode $reduce, [array $options = array()])
o public bool|array MongoCollection::insert (array|object $document, [array $options = array()])
o public array[MongoCommandCursor] MongoCollection::parallelCollectionScan (int $num_cursors)
o public bool|array MongoCollection::remove ([array $criteria = array()], [array $options = array()])
o public mixed MongoCollection::save (array|object $document, [array $options = array()])
o public bool MongoCollection::setReadPreference (string $read_preference, [array $tags])
o public bool MongoCollection::setSlaveOkay ([bool $ok = true])
o public bool MongoCollection::setWriteConcern (mixed $w, [int $wtimeout])
o static protected string MongoCollection::toIndexString (mixed $keys)
o public string MongoCollection::__toString (void )
o public bool|array MongoCollection::update (array $criteria, array $new_object, [array $options = array()])
o public array MongoCollection::validate FALSE ([bool $scan_data])
PREDEFINED CONSTANTS
o MongoCollection::ASCENDING - 1 - Ascending direction for sorts and index creation.
o MongoCollection::DESCENDING - -1 - Descending direction for sorts and index creation.
FIELDS
o $db
- The "parent" database for this collection.
o $w
- The number of servers to replicate a change to before returning success. Value is inherited from the parent database. The Mon-
goDB class has a more detailed description of how w works.
o $wtimeout
- The number of milliseconds to wait for $this->w replications to take place. Value is inherited from the parent database. The
MongoDB class has a more detailed description of how wtimeout works.
SEE ALSO
MongoDB core docs on collections.
PHP Documentation Group MONGOCOLLECTION(3)