Class FindOneAndReplaceOperation<TResult>
- Namespace
- MongoDB.Driver.Core.Operations
- Assembly
- MongoDB.Driver.Core.dll
Represents a find one and replace operation.
public class FindOneAndReplaceOperation<TResult> : FindAndModifyOperationBase<TResult>, IWriteOperation<TResult>, IRetryableWriteOperation<TResult>, IExecutableInRetryableWriteContext<TResult>
Type Parameters
TResult
The type of the result.
- Inheritance
-
FindAndModifyOperationBase<TResult>FindOneAndReplaceOperation<TResult>
- Implements
-
IWriteOperation<TResult>IRetryableWriteOperation<TResult>IExecutableInRetryableWriteContext<TResult>
- Inherited Members
- Extension Methods
Constructors
FindOneAndReplaceOperation(CollectionNamespace, BsonDocument, BsonDocument, IBsonSerializer<TResult>, MessageEncoderSettings)
Initializes a new instance of the FindOneAndReplaceOperation<TResult> class.
public FindOneAndReplaceOperation(CollectionNamespace collectionNamespace, BsonDocument filter, BsonDocument replacement, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings)
Parameters
collectionNamespace
CollectionNamespaceThe collection namespace.
filter
BsonDocumentThe filter.
replacement
BsonDocumentThe replacement.
resultSerializer
IBsonSerializer<TResult>The result serializer.
messageEncoderSettings
MessageEncoderSettingsThe 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.
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.
Replacement
Gets the replacement document.
public BsonDocument Replacement { get; }
Property Value
- BsonDocument
The replacement document.
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.
Methods
GetCommandValidator()
Gets the command validator.
protected override IElementNameValidator GetCommandValidator()
Returns
- IElementNameValidator
An element name validator for the command.