Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
MongoDB\Operation\UpdateMany Class Reference
Inheritance diagram for MongoDB\Operation\UpdateMany:
MongoDB\Operation\Executable MongoDB\Operation\Explainable MongoDB\Operation\Executable

Public Member Functions

 __construct (string $databaseName, string $collectionName, $filter, $update, array $options=[])
 Constructs an update command.
 
 execute (Server $server)
 Execute the operation.
 
 getCommandDocument (Server $server)
 Returns the command document for this operation.
 

Constructor & Destructor Documentation

◆ __construct()

MongoDB\Operation\UpdateMany::__construct ( string $databaseName,
string $collectionName,
$filter,
$update,
array $options = [] )

Constructs an update command.

Supported options:

  • arrayFilters (document array): A set of filters specifying to which array elements an update should apply.
  • bypassDocumentValidation (boolean): If true, allows the write to circumvent document level validation.
  • collation (document): Collation specification.
  • comment (mixed): BSON value to attach as a comment to this command.

    This is not supported for servers versions < 4.4.

  • hint (string|document): The index to use. Specify either the index name as a string or the index key pattern as a document. If specified, then the query system will only consider plans using the hinted index.

    This is not supported for server versions < 4.2 and will result in an exception at execution time if used.

  • session (MongoDB\Driver\Session): Client session.
  • upsert (boolean): When true, a new document is created if no document matches the query. The default is false.
  • let (document): Map of parameter names and values. Values must be constant or closed expressions that do not reference document fields. Parameters can then be accessed as variables in an aggregate expression context (e.g. "$$var").
  • writeConcern (MongoDB\Driver\WriteConcern): Write concern.
Parameters
string$databaseNameDatabase name
string$collectionNameCollection name
array | object$filterQuery by which to filter documents
array | object$updateUpdate to apply to the matched documents
array$optionsCommand options
Exceptions
InvalidArgumentExceptionfor parameter/option parsing errors

Member Function Documentation

◆ execute()

MongoDB\Operation\UpdateMany::execute ( Server $server)

Execute the operation.

See also
Executable\execute()
Return values
UpdateResult
Exceptions
UnsupportedExceptionif collation is used and unsupported
DriverRuntimeExceptionfor other driver errors (e.g. connection errors)

Implements MongoDB\Operation\Executable.

◆ getCommandDocument()

MongoDB\Operation\UpdateMany::getCommandDocument ( Server $server)

Returns the command document for this operation.

See also
Explainable\getCommandDocument()
Return values
array

Implements MongoDB\Operation\Explainable.


The documentation for this class was generated from the following file: