Class CountDocumentsOperation
- Namespace
- MongoDB.Driver.Core.Operations
- Assembly
- MongoDB.Driver.Core.dll
Represents a count documents operation. For a fast estimate of the total documents in a collection see CountOperation.
public class CountDocumentsOperation : IReadOperation<long>
- Inheritance
-
CountDocumentsOperation
- Implements
- Inherited Members
- Extension Methods
Constructors
CountDocumentsOperation(CollectionNamespace, MessageEncoderSettings)
Initializes a new instance of the CountOperation class.
public CountDocumentsOperation(CollectionNamespace collectionNamespace, MessageEncoderSettings messageEncoderSettings)
Parameters
collectionNamespace
CollectionNamespaceThe collection namespace.
messageEncoderSettings
MessageEncoderSettingsThe message encoder settings.
Properties
Collation
Gets or sets the collation.
public Collation Collation { get; set; }
Property Value
- Collation
The collation.
CollectionNamespace
Gets the collection namespace.
public CollectionNamespace CollectionNamespace { get; }
Property Value
- CollectionNamespace
The collection namespace.
Comment
Gets or sets the comment.
public BsonValue Comment { get; set; }
Property Value
- BsonValue
The comment.
Filter
Gets or sets the filter.
public BsonDocument Filter { get; set; }
Property Value
- BsonDocument
The filter.
Hint
Gets or sets the index hint.
public BsonValue Hint { get; set; }
Property Value
- BsonValue
The index hint.
Limit
Gets or sets a limit on the number of matching documents to count.
public long? Limit { get; set; }
Property Value
- long?
A limit on the number of matching documents to count.
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.
MessageEncoderSettings
Gets the message encoder settings.
public MessageEncoderSettings MessageEncoderSettings { get; }
Property Value
- MessageEncoderSettings
The message encoder settings.
ReadConcern
Gets or sets the read concern.
public ReadConcern ReadConcern { get; set; }
Property Value
- ReadConcern
The read concern.
RetryRequested
Gets or sets a value indicating whether to retry.
public bool RetryRequested { get; set; }
Property Value
- bool
Whether to retry.
Skip
Gets or sets the number of documents to skip before counting the remaining matching documents.
public long? Skip { get; set; }
Property Value
- long?
The number of documents to skip before counting the remaining matching documents.
Methods
Execute(IReadBinding, CancellationToken)
Executes the operation.
public long Execute(IReadBinding binding, CancellationToken cancellationToken)
Parameters
binding
IReadBindingThe binding.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- long
The result of the operation.
ExecuteAsync(IReadBinding, CancellationToken)
Executes the operation.
public Task<long> ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
Parameters
binding
IReadBindingThe binding.
cancellationToken
CancellationTokenThe cancellation token.