Skip to content

Latest commit

 

History

History
203 lines (81 loc) · 2.33 KB

InsertMany.md

File metadata and controls

203 lines (81 loc) · 2.33 KB

InsertMany

Operation for inserting multiple documents with the insert command.

See Also:

Properties

databaseName

private string $databaseName

collectionName

private string $collectionName

documents

private object[]|array[] $documents

options

private array $options

Methods

__construct

Constructs an insert command.

public __construct(string $databaseName, string $collectionName, array[]|object[] $documents, array $options = []): mixed

Supported options:

  • bypassDocumentValidation (boolean): If true, allows the write to circumvent document level validation.

  • 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:

Parameter Type Description
$databaseName string Database name
$collectionName string Collection name
$documents array[]|object[] List of documents to insert
$options array Command options

execute

Execute the operation.

public execute(\MongoDB\Driver\Server $server): \MongoDB\InsertManyResult

Parameters:

Parameter Type Description
$server \MongoDB\Driver\Server

See Also:

  • \MongoDB\Operation\Executable::execute() -

createBulkWriteOptions

Create options for constructing the bulk write.

private createBulkWriteOptions(): array

See Also:


createExecuteOptions

Create options for executing the bulk write.

private createExecuteOptions(): array

See Also: