Property | Type | Description | |
---|---|---|---|
$db | MongoDB |
Property | Type | Description | |
---|---|---|---|
$collection | MongoDB\Collection | ||
$name | string |
Method | Description | |
---|---|---|
__construct ( MongoDB $db, string $name ) | Creates a new collection | |
__get ( string $name ) : MongoCollection | Gets a collection | |
__set ( string $name, mixed $value ) | ||
__sleep ( ) : array | ||
__toString ( ) : string | String representation of this collection | |
aggregate ( array $pipeline, array $op = [] ) : array | Perform an aggregation using the aggregation framework | |
aggregateCursor ( array $pipeline, array $options = [] ) : MongoCommandCursor | Execute an aggregation pipeline command and retrieve results through a cursor | |
batchInsert ( array &$a, array $options = [] ) : mixed | Inserts multiple documents into this collection | |
count ( array | stdClass $query = [], array $options = [] ) : integer | Counts the number of documents in this collection | |
createDBRef ( array | object $document_or_id ) : array | Creates a database reference | |
createIndex ( array $keys, array $options = [] ) : array | Creates an index on the given field(s), or does nothing if the index already exists | |
deleteIndex ( string | array $keys ) : array | Deletes an index from this collection | |
deleteIndexes ( ) : array | Delete all indexes for this collection | |
distinct ( string $key, array $query = [] ) : array | boolean | Retrieve a list of distinct values for the given key across a collection | |
drop ( ) : array | Drops this collection | |
ensureIndex ( array $keys, array $options = [] ) : array | Creates an index on the given field(s), or does nothing if the index already exists | |
find ( array $query = [], array $fields = [] ) : MongoCursor | Querys this collection | |
findAndModify ( array $query, array $update = null, array $fields = null, array $options = [] ) : array | Update a document and return it | |
findOne ( array $query = [], array $fields = [], array $options = [] ) : array | null | Querys this collection, returning a single element | |
getCollection ( ) : MongoDB\Collection | Gets the underlying collection for this object | |
getDBRef ( array $ref ) : array | Fetches the document pointed to by a database reference | |
getIndexInfo ( ) : array | Returns an array of index names for this collection | |
getName ( ) : string | Returns this collection's name | |
group ( mixed $keys, array $initial, MongoCode | string $reduce, array $condition = [] ) : array | Performs an operation similar to SQL's GROUP BY command | |
insert ( array | object &$a, array $options = [] ) : boolean | array | Inserts an array into the collection | |
parallelCollectionScan ( integer $num_cursors ) : MongoCommandCursor[] | Returns an array of cursors to iterator over a full collection in parallel | |
remove ( array $criteria = [], array $options = [] ) : boolean | array | Remove records from this collection | |
save ( array | object &$a, array $options = [] ) : array | boolean | Saves an object to this collection | |
setReadPreference ( $readPreference, $tags = null ) | ||
setWriteConcern ( $wstring, $wtimeout ) | ||
update ( array $criteria, array $newobj, array $options = [] ) : boolean | Update records based on a given criteria | |
validate ( boolean $scan_data = FALSE ) : array | Validates this collection |
Method | Description | |
---|---|---|
notImplemented ( ) |
Method | Description | |
---|---|---|
checkCollectionName ( $name ) | ||
convertWriteConcernOptions ( array $options ) : array | Converts legacy write concern options to a WriteConcern object | |
createCollectionObject ( ) : MongoDB\Collection | ||
ensureDocumentHasMongoId ( array | object &$document ) : MongoId |
public __construct ( MongoDB $db, string $name ) | ||
$db | MongoDB | Parent database. |
$name | string | Name for this collection. |
public __toString ( ) : string | ||
return | string | Returns the full name of this collection. |
public aggregateCursor ( array $pipeline, array $options = [] ) : MongoCommandCursor | ||
$pipeline | array | |
$options | array | |
return | MongoCommandCursor |
public batchInsert ( array &$a, array $options = [] ) : mixed | ||
$a | array | An array of arrays. |
$options | array | Options for the inserts. |
return | mixed | If "safe" is set, returns an associative array with the status of the inserts ("ok") and any error that may have occured ("err"). Otherwise, returns TRUE if the batch insert was successfully sent, FALSE otherwise. |
public deleteIndexes ( ) : array | ||
return | array | Returns the database response. |
public findAndModify ( array $query, array $update = null, array $fields = null, array $options = [] ) : array | ||
$query | array | The query criteria to search for. |
$update | array | The update criteria. |
$fields | array | Optionally only return these fields. |
$options | array | An array of options to apply, such as remove the match document from the DB and return it. |
return | array | Returns the original document, or the modified document when new is set. |
public getCollection ( ) : MongoDB\Collection | ||
return | MongoDB\Collection |
public getIndexInfo ( ) : array | ||
return | array | Returns a list of index names. |
public group ( mixed $keys, array $initial, MongoCode | string $reduce, array $condition = [] ) : array | ||
$keys | mixed | Fields to group by. If an array or non-code object is passed, it will be the key used to group results. |
$initial | array | Initial value of the aggregation counter object. |
$reduce | MongoCode | string | A function that aggregates (reduces) the objects iterated. |
$condition | array | An condition that must be true for a row to be considered. |
return | array |
public parallelCollectionScan ( integer $num_cursors ) : MongoCommandCursor[] | ||
$num_cursors | integer | The number of cursors to request from the server. Please note, that the server can return less cursors than you requested. |
return | MongoCommandCursor[] |
public remove ( array $criteria = [], array $options = [] ) : boolean | array | ||
$criteria | array | Query criteria for the documents to delete. |
$options | array | An array of options for the remove operation. |
return | boolean | array | Returns an array containing the status of the removal if the "w" option is set. Otherwise, returns TRUE. |
public save ( array | object &$a, array $options = [] ) : array | boolean | ||
$a | array | object | Array to save. If an object is used, it may not have protected or private properties. |
$options | array | Options for the save. |
return | array | boolean | If w was set, returns an array containing the status of the save. Otherwise, returns a boolean representing if the array was not empty (an empty array will not be inserted). |