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

Public Member Functions

 __construct (string $databaseName, string $collectionName, array $documents, array $options=[])
 Constructs an insert command.
 
 execute (Server $server)
 Execute the operation.
 

Constructor & Destructor Documentation

◆ __construct()

MongoDB\Operation\InsertMany::__construct ( string $databaseName,
string $collectionName,
array $documents,
array $options = [] )

Constructs an insert command.

Supported options:

  • bypassDocumentValidation (boolean): If true, allows the write to circumvent document level validation.
  • comment (mixed): BSON value to attach as a comment to the command(s) associated with this insert.

    This is not supported for servers versions < 4.4.

  • ordered (boolean): If true, when an insert fails, return without performing the remaining writes. If false, when a write fails, continue with the remaining writes, if any. The default is true.
  • session (MongoDB\Driver\Session): Client session.
  • writeConcern (MongoDB\Driver\WriteConcern): Write concern.
Parameters
string$databaseNameDatabase name
string$collectionNameCollection name
array[] | object[]$documentsList of documents to insert
array$optionsCommand options
Exceptions
InvalidArgumentExceptionfor parameter/option parsing errors

Member Function Documentation

◆ execute()

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

Execute the operation.

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

Implements MongoDB\Operation\Executable.


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