Method QueryAsync
QueryAsync<TDocument>(CollectionNamespace, BsonDocument, BsonDocument, IElementNameValidator, int, int, bool, bool, bool, bool, bool, IBsonSerializer<TDocument>, MessageEncoderSettings, CancellationToken)
Executes a Query protocol.
Task<CursorBatch<TDocument>> QueryAsync<TDocument>(CollectionNamespace collectionNamespace, BsonDocument query, BsonDocument fields, IElementNameValidator queryValidator, int skip, int batchSize, bool secondaryOk, bool partialOk, bool noCursorTimeout, bool tailableCursor, bool awaitData, IBsonSerializer<TDocument> serializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
Parameters
collectionNamespace
CollectionNamespaceThe collection namespace.
query
BsonDocumentThe query.
fields
BsonDocumentThe fields.
queryValidator
IElementNameValidatorThe query validator.
skip
intThe number of documents to skip.
batchSize
intThe size of a batch.
secondaryOk
boolif set to
true
sets the SecondaryOk bit to true in the query message sent to the server.partialOk
boolif set to
true
the server is allowed to return partial results if any shards are unavailable.noCursorTimeout
boolif set to
true
the server will not timeout the cursor.tailableCursor
boolif set to
true
the query should return a tailable cursor.awaitData
boolif set to
true
the server should await awhile before returning an empty batch for a tailable cursor.serializer
IBsonSerializer<TDocument>The serializer.
messageEncoderSettings
MessageEncoderSettingsThe message encoder settings.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<CursorBatch<TDocument>>
A Task whose result is the result of the Insert protocol.
Type Parameters
TDocument
The type of the document.
QueryAsync<TDocument>(CollectionNamespace, BsonDocument, BsonDocument, IElementNameValidator, int, int, bool, bool, bool, bool, bool, bool, IBsonSerializer<TDocument>, MessageEncoderSettings, CancellationToken)
Executes a Query protocol.
[Obsolete("Use an overload that does not have an oplogReplay parameter instead.")]
Task<CursorBatch<TDocument>> QueryAsync<TDocument>(CollectionNamespace collectionNamespace, BsonDocument query, BsonDocument fields, IElementNameValidator queryValidator, int skip, int batchSize, bool secondaryOk, bool partialOk, bool noCursorTimeout, bool oplogReplay, bool tailableCursor, bool awaitData, IBsonSerializer<TDocument> serializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
Parameters
collectionNamespace
CollectionNamespaceThe collection namespace.
query
BsonDocumentThe query.
fields
BsonDocumentThe fields.
queryValidator
IElementNameValidatorThe query validator.
skip
intThe number of documents to skip.
batchSize
intThe size of a batch.
secondaryOk
boolif set to
true
sets the SecondaryOk bit to true in the query message sent to the server.partialOk
boolif set to
true
the server is allowed to return partial results if any shards are unavailable.noCursorTimeout
boolif set to
true
the server will not timeout the cursor.oplogReplay
boolif set to
true
the OplogReplay bit will be set.tailableCursor
boolif set to
true
the query should return a tailable cursor.awaitData
boolif set to
true
the server should await awhile before returning an empty batch for a tailable cursor.serializer
IBsonSerializer<TDocument>The serializer.
messageEncoderSettings
MessageEncoderSettingsThe message encoder settings.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<CursorBatch<TDocument>>
A Task whose result is the result of the Insert protocol.
Type Parameters
TDocument
The type of the document.