PHP Class Phalcon\Db\Adapter\MongoDB\Functions

Show file Open project: phalcon/incubator Class Usage Examples

Public Methods

Method Description
extractIdFromInsertedDocument ( array | object $document ) : mixed Extracts an ID from an inserted document.
generateIndexName ( array | object $document ) : string Generate an index name from a key specification.
isFirstKeyOperator ( array | object $document ) : boolean Return whether the first key in the document starts with a "$" character.
isLastPipelineOperatorOut ( array $pipeline ) : boolean Return whether the aggregation pipeline ends with an $out operator.
isStringArray ( $input ) : boolean
readConcernAsDocument ( MongoDB\Driver\ReadConcern $readConcern ) : stdClass Converts a ReadConcern instance to a stdClass for use in a BSON document.
serverSupportsFeature ( MongoDB\Driver\Server $server, integer $feature ) : boolean Return whether the server supports a particular feature.

Method Details

extractIdFromInsertedDocument() public static method

This function is used when BulkWrite::insert() does not return a generated ID, which means that the ID should be fetched from an array offset, public property, or in the data returned by bsonSerialize().
See also: https://jira.mongodb.org/browse/PHPC-382
public static extractIdFromInsertedDocument ( array | object $document ) : mixed
$document array | object Inserted document
return mixed

generateIndexName() public static method

Generate an index name from a key specification.
public static generateIndexName ( array | object $document ) : string
$document array | object Document containing fields mapped to values, which denote order or an index type
return string

isFirstKeyOperator() public static method

This is used for differentiating update and replacement documents.
public static isFirstKeyOperator ( array | object $document ) : boolean
$document array | object Update or replacement document
return boolean

isLastPipelineOperatorOut() public static method

This is used for determining whether the aggregation pipeline msut be executed against a primary server.
public static isLastPipelineOperatorOut ( array $pipeline ) : boolean
$pipeline array List of pipeline operations
return boolean

isStringArray() public static method

public static isStringArray ( $input ) : boolean
$input
return boolean

readConcernAsDocument() public static method

Converts a ReadConcern instance to a stdClass for use in a BSON document.
See also: https://jira.mongodb.org/browse/PHPC-498
public static readConcernAsDocument ( MongoDB\Driver\ReadConcern $readConcern ) : stdClass
$readConcern MongoDB\Driver\ReadConcern Read concern
return stdClass

serverSupportsFeature() public static method

Return whether the server supports a particular feature.
public static serverSupportsFeature ( MongoDB\Driver\Server $server, integer $feature ) : boolean
$server MongoDB\Driver\Server Server to check
$feature integer Feature constant (i.e. wire protocol version)
return boolean