PHP 클래스 Mongolid\DataMapper\BulkWrite

It's an incomplete and highly opinionated abstraction but yet flexible, since you are able to access the driver's API and can work with both ActiveRecord and DataMapper, since this class relies on the Schema and both classes implements HasSchemaInterface.
파일 보기 프로젝트 열기: leroy-merlin-br/mongolid 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$bulkWrite MongoDB\Driver\BulkWrite
$options array
$schema Mongolid\Schema\Schema

공개 메소드들

메소드 설명
__construct ( Mongolid\Schema\HasSchemaInterface $entity ) BulkWrite constructor.
execute ( integer $writeConcern = 1 ) : MongoDB\Driver\WriteResult Execute the BulkWrite, using a connection from the Pool.
getBulkWrite ( ) : MongoDB\Driver\BulkWrite Get the BulkWrite object to perform other operations not covered by this class.
setBulkWrite ( MongoDB\Driver\BulkWrite $bulkWrite ) Set BulkWrite object that will receive all operations and later be executed.
updateOne ( MongoDB\BSON\ObjectID | string $id, array $dataToSet, array $options = ['upsert' => true] ) Add an update operation to the Bulk, where only one record is updated, by _id.

메소드 상세

__construct() 공개 메소드

BulkWrite constructor.
public __construct ( Mongolid\Schema\HasSchemaInterface $entity )
$entity Mongolid\Schema\HasSchemaInterface

execute() 공개 메소드

The collection is inferred from entity's collection name.
public execute ( integer $writeConcern = 1 ) : MongoDB\Driver\WriteResult
$writeConcern integer
리턴 MongoDB\Driver\WriteResult

getBulkWrite() 공개 메소드

Get the BulkWrite object to perform other operations not covered by this class.
public getBulkWrite ( ) : MongoDB\Driver\BulkWrite
리턴 MongoDB\Driver\BulkWrite

setBulkWrite() 공개 메소드

Set BulkWrite object that will receive all operations and later be executed.
public setBulkWrite ( MongoDB\Driver\BulkWrite $bulkWrite )
$bulkWrite MongoDB\Driver\BulkWrite

updateOne() 공개 메소드

Be aware that working with multiple levels of nesting on $dataToSet may have an undesired behavior that could lead to data loss on a specific key.
또한 보기: https://docs.mongodb.com/manual/reference/operator/update/set/#set-top-level-fields
public updateOne ( MongoDB\BSON\ObjectID | string $id, array $dataToSet, array $options = ['upsert' => true] )
$id MongoDB\BSON\ObjectID | string
$dataToSet array
$options array

프로퍼티 상세

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

protected BulkWrite,MongoDB\Driver $bulkWrite
리턴 MongoDB\Driver\BulkWrite

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

protected array $options
리턴 array

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

protected Schema,Mongolid\Schema $schema
리턴 Mongolid\Schema\Schema