array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'mongodb-driver-bulkwritecommand.count.php', 1 => 'MongoDB\\Driver\\BulkWriteCommand::count', 2 => 'Count number of write operations in the BulkWriteCommand', ), 'up' => array ( 0 => 'class.mongodb-driver-bulkwritecommand.php', 1 => 'MongoDB\\Driver\\BulkWriteCommand', ), 'prev' => array ( 0 => 'mongodb-driver-bulkwritecommand.construct.php', 1 => 'MongoDB\\Driver\\BulkWriteCommand::__construct', ), 'next' => array ( 0 => 'mongodb-driver-bulkwritecommand.deletemany.php', 1 => 'MongoDB\\Driver\\BulkWriteCommand::deleteMany', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/mongodb/driver/bulkwritecommand/count.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

MongoDB\Driver\BulkWriteCommand::count

(mongodb >=2.1.0)

MongoDB\Driver\BulkWriteCommand::countCount number of write operations in the BulkWriteCommand

Опис

public MongoDB\Driver\BulkWriteCommand::count(): int

Returns the number of write operations added to the MongoDB\Driver\BulkWriteCommand object.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns number of write operations added to the MongoDB\Driver\BulkWriteCommand object.

Помилки/виключення

Приклади

Приклад #1 MongoDB\Driver\BulkWriteCommand::count() example

<?php

$bulk
= new MongoDB\Driver\BulkWriteCommand;
$bulk->insertOne('db.coll', ['_id' => 1, 'x' => 1]);
$bulk->insertOne('db.coll', ['_id' => 2, 'x' => 2]);
$bulk->updateOne('db.coll', ['x' => 2], ['$set' => ['x' => 1]]);
$bulk->deleteMany('db.coll', ['x' => 1]);

var_dump(count($bulk));

?>

Поданий вище приклад виведе:

int(4)