MongoCollection::getName

(PECL mongo >=0.9.0) Returns this collection's name public string MongoCollection::getName ( void ) Returns: Returns the name of this collection. Examples: MongoCollection::getName() example <?php $m = new MongoClient(); $c = $m->foo->bar->baz; echo "Working with collection " . $c->getName() . ".\n"; //

MongoCollection::getIndexInfo

(PECL mongo >=0.9.0) Returns information about indexes on this collection public array MongoCollection::getIndexInfo ( void ) Returns: This function returns an array in which each element describes an index. Elements will contain the values name for the name of the index, ns for the namespace (a combination of the database and collection name), and key for a list of all fields in the index and th

MongoCollection::getDBRef

(PECL mongo >=0.9.0) Fetches the document pointed to by a database reference public array MongoCollection::getDBRef ( array $ref ) Parameters: ref A database reference. Returns: Returns the database document pointed to by the reference. Examples: MongoCollection::getDBRef() example

MongoCollection::__get

(PECL mongo >=1.0.2) Gets a collection public MongoCollection MongoCollection::__get ( string $name ) A concise syntax for getting a collection with a dot-separated name. If a collection name contains strange characters, you may have to use MongoDB::selectCollection() instead. <?php $mongo = new MongoClient(); // the following two lines are equivalent $collection = $mongo->selectDB("foo")->selectCollection("

MongoCollection::findOne

(PECL mongo >=0.9.0) Queries this collection, returning a single element public array MongoCollection::findOne ([ array $query = array() [, array $fields = array() [, array $options = array() ]]] ) As opposed to MongoCollection::find(), this method will return only the first result from the result set, and not a MongoCursor that can be iterated over. Parameters: query

MongoCollection::findAndModify

(PECL mongo >=1.3.0) Update a document and return it public array MongoCollection::findAndModify ( array $query [, array $update [, array $fields [, array $options ]]] ) The findAndModify command atomically modifies and returns a single document. By default, the returned document does not include the modifications made on the update. To return the document with the modifications made on the update, use the new option.

MongoCollection::find

(PECL mongo >=0.9.0) Queries this collection, returning a MongoCursor for the result set public MongoCursor MongoCollection::find ([ array $query = array() [, array $fields = array() ]] ) Parameters: query The fields for which to search. MongoDB's query language is quite extensive. The PHP driver will in almost all cases pass the query straight through to the server, s

MongoCollection::ensureIndex

(PECL mongo >=0.9.0) Creates an index on the specified field(s) if it does not already exist. public bool MongoCollection::ensureIndex ( string|array $key|keys [, array $options = array() ] ) Creates an index on the specified field(s) if it does not already exist. Fields may be indexed with a direction (e.g. ascending or descending) or a special type (e.g. text, geospatial, hashed). Note: This method will use the

MongoCollection::drop

(PECL mongo >=0.9.0) Drops this collection public array MongoCollection::drop ( void ) Drops this collection and deletes its indices. Returns: Returns the database response. Examples: MongoCollection::drop() example This example demonstrates how to drop a collection and the response to expect. <?php $collection = $

MongoCollection::distinct

(PECL mongo >=1.2.11) Retrieve a list of distinct values for the given key across a collection. public array MongoCollection::distinct ( string $key [, array $query ] ) The distinct command returns a list of distinct values for the given key across a collection. Parameters: key The key to use. query An optional query parameters