mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-25 09:28:18 +02:00
749b2d391a
Some highlights: fix class/interface syntax; additional class/method docs; Manager convenience methods; more value objects.
37 lines
676 B
PHP
37 lines
676 B
PHP
<?php
|
|
|
|
namespace MongoDB\Write;
|
|
|
|
/**
|
|
* Aggregates a collection of update operations, to be executed in batches.
|
|
*/
|
|
final class UpdateBatch implements WriteBatch
|
|
{
|
|
private $documents;
|
|
private $writeOptions;
|
|
|
|
/**
|
|
* @param array $writeOptions Ordering and write concern options
|
|
*/
|
|
public function __construct(array $writeOptions)
|
|
{
|
|
$this->writeOptions = $writeOptions;
|
|
}
|
|
|
|
/**
|
|
* @see WriteBatch::add()
|
|
*/
|
|
public function add($document)
|
|
{
|
|
$this->documents[] = $document;
|
|
}
|
|
|
|
/**
|
|
* @see Countable::count()
|
|
*/
|
|
public function count()
|
|
{
|
|
return count($this->documents);
|
|
}
|
|
}
|