PHP 클래스 Phalcon\Db\Adapter\MongoDB\Collection

파일 보기 프로젝트 열기: phalcon/incubator

공개 메소드들

메소드 설명
__construct ( MongoDB\Driver\Manager $manager, string $databaseName, string $collectionName, array $options = [] ) Constructs new Collection instance.
__debugInfo ( ) : array Return internal properties for debugging purposes.
__toString ( ) : string Return the collection namespace (e.g. "db.collection").
aggregate ( array $pipeline, array $options = [] ) : Traversable Executes an aggregation framework pipeline on the collection.
bulkWrite ( array $operations, array $options = [] ) : BulkWriteResult Executes multiple write operations.
count ( array | object $filter = [], array $options = [] ) : integer Gets the number of documents matching the filter.
createIndex ( array | object $key, array $options = [] ) : string Create a single index for the collection.
createIndexes ( array $indexes ) : string[] Create one or more indexes for the collection.
deleteMany ( array | object $filter, array $options = [] ) : DeleteResult Deletes all documents matching the filter.
deleteOne ( array | object $filter, array $options = [] ) : DeleteResult Deletes at most one document matching the filter.
distinct ( string $fieldName, array | object $filter = [], array $options = [] ) : mixed[] Finds the distinct values for a specified field across the collection.
drop ( array $options = [] ) : array | object Drop this collection.
dropIndex ( string $indexName, array $options = [] ) : array | object Drop a single index in the collection.
dropIndexes ( array $options = [] ) : array | object Drop all indexes in the collection.
find ( array | object $filter = [], array $options = [] ) : MongoDB\Driver\Cursor Finds documents matching the query.
findOne ( array | object $filter = [], array $options = [] ) : array | object | null Finds a single document matching the query.
findOneAndDelete ( array | object $filter, array $options = [] ) : object | null Finds a single document and deletes it, returning the original.
findOneAndReplace ( 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 ( 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.
getCollectionName ( ) : string Return the collection name.
getDatabaseName ( ) : string Return the database name.
getNamespace ( ) : string Return the collection namespace.
insertMany ( array $documents, array $options = [] ) : InsertManyResult Inserts multiple documents.
insertOne ( array | object $document, array $options = [] ) : InsertOneResult Inserts one document.
listIndexes ( array $options = [] ) : Phalcon\Db\Adapter\MongoDB\Model\IndexInfoIterator Returns information for all indexes for the collection.
replaceOne ( array | object $filter, array | object $replacement, array $options = [] ) : UpdateResult Replaces at most one document matching the filter.
updateMany ( array | object $filter, array | object $update, array $options = [] ) : UpdateResult Updates all documents matching the filter.
updateOne ( array | object $filter, array | object $update, array $options = [] ) : UpdateResult Updates at most one document matching the filter.
withOptions ( array $options = [] ) : Collection Get a clone of this collection with different options.

메소드 상세

__construct() 공개 메소드

This class provides methods for collection-specific operations, such as CRUD (i.e. create, read, update, and delete) and index management. Supported options: * readConcern (MongoDB\Driver\ReadConcern): The default read concern to use for collection operations. Defaults to the Manager's read concern. * readPreference (MongoDB\Driver\ReadPreference): The default read preference to use for collection operations. Defaults to the Manager's read preference. * typeMap (array): Default type map for cursors and BSON documents. * writeConcern (MongoDB\Driver\WriteConcern): The default write concern to use for collection operations. Defaults to the Manager's write concern.
public __construct ( MongoDB\Driver\Manager $manager, string $databaseName, string $collectionName, array $options = [] )
$manager MongoDB\Driver\Manager Manager instance from the driver
$databaseName string Database name
$collectionName string Collection name
$options array Collection options

__debugInfo() 공개 메소드

Return internal properties for debugging purposes.
또한 보기: http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo
public __debugInfo ( ) : array
리턴 array

__toString() 공개 메소드

Return the collection namespace (e.g. "db.collection").
또한 보기: https://docs.mongodb.org/manual/faq/developers/#faq-dev-namespace
public __toString ( ) : string
리턴 string

aggregate() 공개 메소드

Note: this method's return value depends on the MongoDB server version and the "useCursor" option. If "useCursor" is true, a Cursor will be returned; otherwise, an ArrayIterator is returned, which wraps the "result" array from the command response document. Note: BSON deserialization of inline aggregation results (i.e. not using a command cursor) does not yet support a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
또한 보기: Aggregate::__construct() for supported options
public aggregate ( array $pipeline, array $options = [] ) : Traversable
$pipeline array List of pipeline operations
$options array Command options
리턴 Traversable

bulkWrite() 공개 메소드

Executes multiple write operations.
또한 보기: BulkWrite::__construct() for supported options
public bulkWrite ( array $operations, array $options = [] ) : BulkWriteResult
$operations array List of write operations
$options array Command options
리턴 BulkWriteResult

count() 공개 메소드

Gets the number of documents matching the filter.
또한 보기: Count::__construct() for supported options
public count ( array | object $filter = [], array $options = [] ) : integer
$filter array | object Query by which to filter documents
$options array Command options
리턴 integer

createIndex() 공개 메소드

Create a single index for the collection.
또한 보기: Collection::createIndexes()
public createIndex ( array | object $key, array $options = [] ) : string
$key array | object Document containing fields mapped to values, which denote order or an index type
$options array Index options
리턴 string The name of the created index

createIndexes() 공개 메소드

Each element in the $indexes array must have a "key" document, which contains fields mapped to an order or type. Other options may follow. For example: $indexes = [ Create a unique index on the "username" field [ 'key' => [ 'username' => 1 ], 'unique' => true ], Create a 2dsphere index on the "loc" field with a custom name [ 'key' => [ 'loc' => '2dsphere' ], 'name' => 'geo' ], ]; If the "name" option is unspecified, a name will be generated from the "key" document.
또한 보기: http://docs.mongodb.org/manual/reference/command/createIndexes/
또한 보기: http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/
public createIndexes ( array $indexes ) : string[]
$indexes array List of index specifications
리턴 string[] The names of the created indexes

deleteMany() 공개 메소드

Deletes all documents matching the filter.
또한 보기: DeleteMany::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/delete/
public deleteMany ( array | object $filter, array $options = [] ) : DeleteResult
$filter array | object Query by which to delete documents
$options array Command options
리턴 DeleteResult

deleteOne() 공개 메소드

Deletes at most one document matching the filter.
또한 보기: DeleteOne::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/delete/
public deleteOne ( array | object $filter, array $options = [] ) : DeleteResult
$filter array | object Query by which to delete documents
$options array Command options
리턴 DeleteResult

distinct() 공개 메소드

Finds the distinct values for a specified field across the collection.
또한 보기: Distinct::__construct() for supported options
public distinct ( string $fieldName, array | object $filter = [], array $options = [] ) : mixed[]
$fieldName string Field for which to return distinct values
$filter array | object Query by which to filter documents
$options array Command options
리턴 mixed[]

drop() 공개 메소드

Drop this collection.
또한 보기: DropCollection::__construct() for supported options
public drop ( array $options = [] ) : array | object
$options array Additional options
리턴 array | object Command result document

dropIndex() 공개 메소드

Drop a single index in the collection.
또한 보기: DropIndexes::__construct() for supported options
public dropIndex ( string $indexName, array $options = [] ) : array | object
$indexName string Index name
$options array Additional options
리턴 array | object Command result document

dropIndexes() 공개 메소드

Drop all indexes in the collection.
또한 보기: DropIndexes::__construct() for supported options
public dropIndexes ( array $options = [] ) : array | object
$options array Additional options
리턴 array | object Command result document

find() 공개 메소드

Finds documents matching the query.
또한 보기: Find::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/core/read-operations-introduction/
public find ( array | object $filter = [], array $options = [] ) : MongoDB\Driver\Cursor
$filter array | object Query by which to filter documents
$options array Additional options
리턴 MongoDB\Driver\Cursor

findOne() 공개 메소드

Finds a single document matching the query.
또한 보기: FindOne::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/core/read-operations-introduction/
public findOne ( array | object $filter = [], array $options = [] ) : array | object | null
$filter array | object Query by which to filter documents
$options array Additional options
리턴 array | object | null

findOneAndDelete() 공개 메소드

The document to return may be null if no document matched the filter. Note: BSON deserialization of the returned document does not yet support a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
또한 보기: FindOneAndDelete::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/findAndModify/
public findOneAndDelete ( array | object $filter, array $options = [] ) : object | null
$filter array | object Query by which to filter documents
$options array Command options
리턴 object | null

findOneAndReplace() 공개 메소드

The document to return may be null if no document matched the filter. By default, the original document is returned. Specify FindOneAndReplace::RETURN_DOCUMENT_AFTER for the "returnDocument" option to return the updated document. Note: BSON deserialization of the returned document does not yet support a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
또한 보기: FindOneAndReplace::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/findAndModify/
public findOneAndReplace ( array | object $filter, array | object $replacement, array $options = [] ) : object | null
$filter array | object Query by which to filter documents
$replacement array | object Replacement document
$options array Command options
리턴 object | null

findOneAndUpdate() 공개 메소드

The document to return may be null if no document matched the filter. By default, the original document is returned. Specify FindOneAndUpdate::RETURN_DOCUMENT_AFTER for the "returnDocument" option to return the updated document. Note: BSON deserialization of the returned document does not yet support a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
또한 보기: FindOneAndReplace::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/findAndModify/
public findOneAndUpdate ( array | object $filter, array | object $update, array $options = [] ) : object | null
$filter array | object Query by which to filter documents
$update array | object Update to apply to the matched document
$options array Command options
리턴 object | null

getCollectionName() 공개 메소드

Return the collection name.
public getCollectionName ( ) : string
리턴 string

getDatabaseName() 공개 메소드

Return the database name.
public getDatabaseName ( ) : string
리턴 string

getNamespace() 공개 메소드

Return the collection namespace.
또한 보기: https://docs.mongodb.org/manual/reference/glossary/#term-namespace
public getNamespace ( ) : string
리턴 string

insertMany() 공개 메소드

Inserts multiple documents.
또한 보기: InsertMany::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/insert/
public insertMany ( array $documents, array $options = [] ) : InsertManyResult
$documents array The documents to insert
$options array Command options
리턴 InsertManyResult

insertOne() 공개 메소드

Inserts one document.
또한 보기: InsertOne::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/insert/
public insertOne ( array | object $document, array $options = [] ) : InsertOneResult
$document array | object The document to insert
$options array Command options
리턴 InsertOneResult

listIndexes() 공개 메소드

Returns information for all indexes for the collection.
또한 보기: ListIndexes::__construct() for supported options
public listIndexes ( array $options = [] ) : Phalcon\Db\Adapter\MongoDB\Model\IndexInfoIterator
$options array
리턴 Phalcon\Db\Adapter\MongoDB\Model\IndexInfoIterator

replaceOne() 공개 메소드

Replaces at most one document matching the filter.
또한 보기: ReplaceOne::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/update/
public replaceOne ( array | object $filter, array | object $replacement, array $options = [] ) : UpdateResult
$filter array | object Query by which to filter documents
$replacement array | object Replacement document
$options array Command options
리턴 UpdateResult

updateMany() 공개 메소드

Updates all documents matching the filter.
또한 보기: UpdateMany::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/update/
public updateMany ( array | object $filter, array | object $update, array $options = [] ) : UpdateResult
$filter array | object Query by which to filter documents
$update array | object Update to apply to the matched documents
$options array Command options
리턴 UpdateResult

updateOne() 공개 메소드

Updates at most one document matching the filter.
또한 보기: UpdateOne::__construct() for supported options
또한 보기: http://docs.mongodb.org/manual/reference/command/update/
public updateOne ( array | object $filter, array | object $update, array $options = [] ) : UpdateResult
$filter array | object Query by which to filter documents
$update array | object Update to apply to the matched document
$options array Command options
리턴 UpdateResult

withOptions() 공개 메소드

Get a clone of this collection with different options.
또한 보기: Collection::__construct() for supported options
public withOptions ( array $options = [] ) : Collection
$options array Collection constructor options
리턴 Collection