Method |
Description |
|
aggregate ( string $collectionName, array $pipeline, array $options = [] ) : Traversable |
Executes an aggregation framework pipeline on the collection. |
|
bulkWrite ( string $collectionName, array $operations, array $options = [] ) : MongoDB\BulkWriteResult |
Executes multiple write operations. |
|
command ( array | object $command, array $options = [] ) : MongoDB\Driver\Cursor |
Execute a command on this database. |
|
connect ( $uri, array $uriOptions = [], array $driverOptions = [] ) : mixed |
Connect to Mongo instance |
|
count ( string $collectionName, array | object $filter = [], array $options = [] ) : integer |
Gets the number of documents matching the filter. |
|
createCollection ( string $collectionName, array $options = [] ) : array | object |
Create collection. |
|
createIndex ( string $collectionName, array | object $key, array $options = [] ) : string |
Create a single index for the collection. |
|
createIndexes ( string $collectionName, array $indexes ) : string[] |
Create one or more indexes for the collection. |
|
delete ( string $collectionName, array | object $filter, array $options = [] ) : MongoDB\DeleteResult |
Deletes all documents matching the filter. |
|
distinct ( string $collectionName, string $fieldName, array | object $filter = [], array $options = [] ) : mixed[] |
Finds the distinct values for a specified field across the collection. |
|
dropCollection ( string $collectionName, array $options = [] ) : array | object |
Drop this collection. |
|
dropIndex ( string $collectionName, string $indexName, array $options = [] ) : array | object |
Drop a single index in the collection. |
|
dropIndexes ( string $collectionName, array $options = [] ) : array | object |
Drop all indexes in the collection. |
|
find ( string $collectionName, array | object $filter = [], array $options = [] ) : MongoDB\Driver\Cursor |
Finds documents matching the query. |
|
findOne ( string $collectionName, array | object $filter = [], array $options = [] ) : object | null |
Finds a single document matching the query. |
|
findOneAndDelete ( string $collectionName, array | object $filter, array $options = [] ) : object | null |
Finds a single document and deletes it, returning the original. |
|
findOneAndReplace ( string $collectionName, array | object $filter, array | object $replacement, array $options = [] ) : object | null |
Finds a single document and replaces it, returning either the original or
the replaced document. |
|
findOneAndUpdate ( string $collectionName, array | object $filter, array | object $update, array $options = [] ) : object | null |
Finds a single document and updates it, returning either the original or
the updated document. |
|
getNamespace ( string $collectionName ) : string |
Return the collection namespace. |
|
id ( null | string $id = null ) : mixed |
Create a mongo ID instance |
|
insertMany ( string $collectionName, array $documents, array $options = [] ) : MongoDB\InsertManyResult |
Inserts multiple documents. |
|
insertOne ( string $collectionName, array | object $document, array $options = [] ) : MongoDB\InsertOneResult |
Inserts one document. |
|
isId ( mixed $id ) : boolean |
Check if given string/object is a valid mongo ID. |
|
listCollections ( array $options = [] ) : mixed |
Returns information for all collections. |
|
listIndexes ( string $collectionName, array $options = [] ) : MongoDB\Model\IndexInfoIterator |
Returns information for all indexes for the collection. |
|
selectDatabase ( string $database ) |
Select database |
|
update ( string $collectionName, array | object $filter, array | object $update, array $options = [] ) : MongoDB\UpdateResult |
Updates all documents matching the filter. |
|