PHP 8.6.0 Alpha 2 available for testing

MongoDB\Driver\BulkWriteCommand::count

(mongodb >=2.1.0)

MongoDB\Driver\BulkWriteCommand::countCuenta el número de operaciones de escritura en el BulkWriteCommand

Descripción

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

Devuelve el número de operaciones de escritura añadidas al objeto MongoDB\Driver\BulkWriteCommand.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Devuelve el número de operaciones de escritura añadidas al objeto MongoDB\Driver\BulkWriteCommand.

Errores/Excepciones

Ejemplos

Ejemplo #1 Ejemplo de MongoDB\Driver\BulkWriteCommand::count()

<?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));

?>

El ejemplo anterior mostrará:

int(4)
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top