PHP 클래스 MongoCollection, horde

파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$db MongoDB

보호된 프로퍼티들

프로퍼티 타입 설명
$collection MongoDB\Collection
$name string

공개 메소드들

메소드 설명
__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

보호된 메소드들

메소드 설명
notImplemented ( )

비공개 메소드들

메소드 설명
checkCollectionName ( $name )
convertWriteConcernOptions ( array $options ) : array Converts legacy write concern options to a WriteConcern object
createCollectionObject ( ) : MongoDB\Collection
ensureDocumentHasMongoId ( array | object &$document ) : MongoId

메소드 상세

__construct() 공개 메소드

Creates a new collection
public __construct ( MongoDB $db, string $name )
$db MongoDB Parent database.
$name string Name for this collection.

__get() 공개 메소드

Gets a collection
public __get ( string $name ) : MongoCollection
$name string The next string in the collection name.
리턴 MongoCollection

__set() 공개 메소드

public __set ( string $name, mixed $value )
$name string
$value mixed

__sleep() 공개 메소드

public __sleep ( ) : array
리턴 array

__toString() 공개 메소드

String representation of this collection
public __toString ( ) : string
리턴 string Returns the full name of this collection.

aggregate() 공개 메소드

Perform an aggregation using the aggregation framework
public aggregate ( array $pipeline, array $op = [] ) : array
$pipeline array
$op array
리턴 array

aggregateCursor() 공개 메소드

Execute an aggregation pipeline command and retrieve results through a cursor
public aggregateCursor ( array $pipeline, array $options = [] ) : MongoCommandCursor
$pipeline array
$options array
리턴 MongoCommandCursor

batchInsert() 공개 메소드

Inserts multiple documents into this collection
public batchInsert ( array &$a, array $options = [] ) : mixed
$a array An array of arrays.
$options array Options for the inserts.
리턴 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.

count() 공개 메소드

Counts the number of documents in this collection
public count ( array | stdClass $query = [], array $options = [] ) : integer
$query array | stdClass
$options array
리턴 integer Returns the number of documents matching the query.

createDBRef() 공개 메소드

Creates a database reference
public createDBRef ( array | object $document_or_id ) : array
$document_or_id array | object Object to which to create a reference.
리턴 array Returns a database reference array.

createIndex() 공개 메소드

Creates an index on the given field(s), or does nothing if the index already exists
public createIndex ( array $keys, array $options = [] ) : array
$keys array Field or fields to use as index.
$options array [optional] This parameter is an associative array of the form array("optionname" => , ...).
리턴 array Returns the database response.

deleteIndex() 공개 메소드

Deletes an index from this collection
public deleteIndex ( string | array $keys ) : array
$keys string | array Field or fields from which to delete the index.
리턴 array Returns the database response.

deleteIndexes() 공개 메소드

Delete all indexes for this collection
public deleteIndexes ( ) : array
리턴 array Returns the database response.

distinct() 공개 메소드

Retrieve a list of distinct values for the given key across a collection
public distinct ( string $key, array $query = [] ) : array | boolean
$key string The key to use.
$query array An optional query parameters
리턴 array | boolean Returns an array of distinct values, or FALSE on failure

drop() 공개 메소드

Drops this collection
public drop ( ) : array
리턴 array Returns the database response.

ensureIndex() 공개 메소드

Creates an index on the given field(s), or does nothing if the index already exists
사용 중단: Use MongoCollection::createIndex() instead.
public ensureIndex ( array $keys, array $options = [] ) : array
$keys array Field or fields to use as index.
$options array [optional] This parameter is an associative array of the form array("optionname" => , ...).
리턴 array Returns the database response.

find() 공개 메소드

Querys this collection
public find ( array $query = [], array $fields = [] ) : MongoCursor
$query array The fields for which to search.
$fields array Fields of the results to return.
리턴 MongoCursor

findAndModify() 공개 메소드

Update a document and return it
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.
리턴 array Returns the original document, or the modified document when new is set.

findOne() 공개 메소드

Querys this collection, returning a single element
public findOne ( array $query = [], array $fields = [], array $options = [] ) : array | null
$query array The fields for which to search.
$fields array Fields of the results to return.
$options array
리턴 array | null

getCollection() 공개 메소드

Gets the underlying collection for this object
public getCollection ( ) : MongoDB\Collection
리턴 MongoDB\Collection

getDBRef() 공개 메소드

Fetches the document pointed to by a database reference
public getDBRef ( array $ref ) : array
$ref array A database reference.
리턴 array Returns the database document pointed to by the reference.

getIndexInfo() 공개 메소드

Returns an array of index names for this collection
public getIndexInfo ( ) : array
리턴 array Returns a list of index names.

getName() 공개 메소드

Returns this collection's name
public getName ( ) : string
리턴 string

group() 공개 메소드

Performs an operation similar to SQL's GROUP BY command
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.
리턴 array

insert() 공개 메소드

Inserts an array into the collection
public insert ( array | object &$a, array $options = [] ) : boolean | array
$a array | object
$options array
리턴 boolean | array Returns an array containing the status of the insertion if the "w" option is set.

notImplemented() 보호된 메소드

protected notImplemented ( )

parallelCollectionScan() 공개 메소드

Returns an array of cursors to iterator over a full collection in parallel
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.
리턴 MongoCommandCursor[]

remove() 공개 메소드

Remove records from this collection
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.
리턴 boolean | array Returns an array containing the status of the removal if the "w" option is set. Otherwise, returns TRUE.

save() 공개 메소드

Saves an object to this collection
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.
리턴 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).

setReadPreference() 공개 메소드

public setReadPreference ( $readPreference, $tags = null )

setWriteConcern() 공개 메소드

public setWriteConcern ( $wstring, $wtimeout )

update() 공개 메소드

Update records based on a given criteria
public update ( array $criteria, array $newobj, array $options = [] ) : boolean
$criteria array Description of the objects to update.
$newobj array The object with which to update the matching records.
$options array
리턴 boolean

validate() 공개 메소드

Validates this collection
public validate ( boolean $scan_data = FALSE ) : array
$scan_data boolean Only validate indices, not the base collection.
리턴 array Returns the database's evaluation of this object.

프로퍼티 상세

$collection 보호되어 있는 프로퍼티

protected Collection,MongoDB $collection
리턴 MongoDB\Collection

$db 공개적으로 프로퍼티

public MongoDB $db
리턴 MongoDB

$name 보호되어 있는 프로퍼티

protected string $name
리턴 string