Table of Contents

Class FindOneAndUpdateOperation<TResult>

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

Represents a find one and update operation.

public class FindOneAndUpdateOperation<TResult> : FindAndModifyOperationBase<TResult>, IWriteOperation<TResult>, IRetryableWriteOperation<TResult>, IExecutableInRetryableWriteContext<TResult>

Type Parameters

TResult

The type of the result.

Inheritance
FindOneAndUpdateOperation<TResult>
Implements
Inherited Members
Extension Methods

Constructors

FindOneAndUpdateOperation(CollectionNamespace, BsonDocument, BsonValue, IBsonSerializer<TResult>, MessageEncoderSettings)

Initializes a new instance of the FindOneAndUpdateOperation<TResult> class.

public FindOneAndUpdateOperation(CollectionNamespace collectionNamespace, BsonDocument filter, BsonValue update, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

filter BsonDocument

The filter.

update BsonValue

The update.

resultSerializer IBsonSerializer<TResult>

The result serializer.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

Properties

ArrayFilters

Gets or sets the array filters.

public IEnumerable<BsonDocument> ArrayFilters { get; set; }

Property Value

IEnumerable<BsonDocument>

The array filters.

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.

Filter

Gets the filter.

public BsonDocument Filter { get; }

Property Value

BsonDocument

The filter.

Hint

Gets or sets the hint.

public BsonValue Hint { get; set; }

Property Value

BsonValue

The hint.

IsUpsert

Gets a value indicating whether a document should be inserted if no matching document is found.

public bool IsUpsert { get; set; }

Property Value

bool

true if a document should be inserted if no matching document is found; otherwise, false.

Let

Gets or sets the let document.

public BsonDocument Let { get; set; }

Property Value

BsonDocument

The let document.

MaxTime

Gets or sets the maximum time the server should spend on this operation.

public TimeSpan? MaxTime { get; set; }

Property Value

TimeSpan?

The maximum time the server should spend on this operation.

Projection

Gets or sets the projection.

public BsonDocument Projection { get; set; }

Property Value

BsonDocument

The projection.

ReturnDocument

Gets or sets which version of the modified document to return.

public ReturnDocument ReturnDocument { get; set; }

Property Value

ReturnDocument

Which version of the modified document to return.

Sort

Gets or sets the sort specification.

public BsonDocument Sort { get; set; }

Property Value

BsonDocument

The sort specification.

Update

Gets or sets the update specification.

public BsonValue Update { get; }

Property Value

BsonValue

The update specification.

Methods

GetCommandValidator()

Gets the command validator.

protected override IElementNameValidator GetCommandValidator()

Returns

IElementNameValidator

An element name validator for the command.