array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), '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)