Table of Contents

Class InsertOpcodeOperation<TDocument>

Namespace
MongoDB.Driver.Core.Operations
Assembly
MongoDB.Driver.Core.dll

Represents an insert operation using the insert opcode.

public class InsertOpcodeOperation<TDocument> : IWriteOperation<IEnumerable<WriteConcernResult>>

Type Parameters

TDocument

The type of the document.

Inheritance
InsertOpcodeOperation<TDocument>
Implements
Inherited Members
Extension Methods

Constructors

InsertOpcodeOperation(CollectionNamespace, BatchableSource<TDocument>, IBsonSerializer<TDocument>, MessageEncoderSettings)

Initializes a new instance of the InsertOpcodeOperation<TDocument> class.

[Obsolete("Use the constructor that takes an IEnumerable<TDocument> instead of a BatchableSource<TDocument>.")]
public InsertOpcodeOperation(CollectionNamespace collectionNamespace, BatchableSource<TDocument> documentSource, IBsonSerializer<TDocument> serializer, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

documentSource BatchableSource<TDocument>

The document source.

serializer IBsonSerializer<TDocument>

The serializer.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

InsertOpcodeOperation(CollectionNamespace, IEnumerable<TDocument>, IBsonSerializer<TDocument>, MessageEncoderSettings)

Initializes a new instance of the InsertOpcodeOperation<TDocument> class.

public InsertOpcodeOperation(CollectionNamespace collectionNamespace, IEnumerable<TDocument> documents, IBsonSerializer<TDocument> serializer, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

documents IEnumerable<TDocument>

The documents.

serializer IBsonSerializer<TDocument>

The serializer.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

Properties

BypassDocumentValidation

Gets or sets a value indicating whether to bypass document validation.

public bool? BypassDocumentValidation { get; set; }

Property Value

bool?

A value indicating whether to bypass document validation.

CollectionNamespace

Gets the collection namespace.

public CollectionNamespace CollectionNamespace { get; }

Property Value

CollectionNamespace

The collection namespace.

ContinueOnError

Gets a value indicating whether the server should continue on error.

public bool ContinueOnError { get; set; }

Property Value

bool

true if the server should continue on error; otherwise, false.

DocumentSource

Gets the document source.

public BatchableSource<TDocument> DocumentSource { get; }

Property Value

BatchableSource<TDocument>

The document source.

Documents

Gets the documents.

public IReadOnlyList<TDocument> Documents { get; }

Property Value

IReadOnlyList<TDocument>

The documents.

MaxBatchCount

Gets or sets the maximum number of documents in a batch.

public int? MaxBatchCount { get; set; }

Property Value

int?

The maximum number of documents in a batch.

MaxDocumentSize

Gets or sets the maximum size of a document.

public int? MaxDocumentSize { get; set; }

Property Value

int?

The maximum size of a document.

MaxMessageSize

Gets or sets the maximum size of a message.

public int? MaxMessageSize { get; set; }

Property Value

int?

The maximum size of a message.

MessageEncoderSettings

Gets the message encoder settings.

public MessageEncoderSettings MessageEncoderSettings { get; }

Property Value

MessageEncoderSettings

The message encoder settings.

RetryRequested

Gets or sets a value indicating whether retry is enabled for the operation.

public bool RetryRequested { get; set; }

Property Value

bool

A value indicating whether retry is enabled.

Serializer

Gets the serializer.

public IBsonSerializer<TDocument> Serializer { get; }

Property Value

IBsonSerializer<TDocument>

The serializer.

WriteConcern

Gets or sets the write concern.

public WriteConcern WriteConcern { get; set; }

Property Value

WriteConcern

The write concern.

Methods

Execute(IWriteBinding, CancellationToken)

Executes the operation.

public IEnumerable<WriteConcernResult> Execute(IWriteBinding binding, CancellationToken cancellationToken)

Parameters

binding IWriteBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

IEnumerable<WriteConcernResult>

The result of the operation.

ExecuteAsync(IWriteBinding, CancellationToken)

Executes the operation.

public Task<IEnumerable<WriteConcernResult>> ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)

Parameters

binding IWriteBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IEnumerable<WriteConcernResult>>

A Task whose result is the result of the operation.