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
collectionNamespaceCollectionNamespaceThe collection namespace.
queryBsonDocumentThe query.
fieldsBsonDocumentThe fields.
queryValidatorIElementNameValidatorThe query validator.
skipintThe number of documents to skip.
batchSizeintThe size of a batch.
secondaryOkboolif set to
truesets the SecondaryOk bit to true in the query message sent to the server.partialOkboolif set to
truethe server is allowed to return partial results if any shards are unavailable.noCursorTimeoutboolif set to
truethe server will not timeout the cursor.tailableCursorboolif set to
truethe query should return a tailable cursor.awaitDataboolif set to
truethe server should await awhile before returning an empty batch for a tailable cursor.serializerIBsonSerializer<TDocument>The serializer.
messageEncoderSettingsMessageEncoderSettingsThe message encoder settings.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<CursorBatch<TDocument>>
A Task whose result is the result of the Insert protocol.
Type Parameters
TDocumentThe 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
collectionNamespaceCollectionNamespaceThe collection namespace.
queryBsonDocumentThe query.
fieldsBsonDocumentThe fields.
queryValidatorIElementNameValidatorThe query validator.
skipintThe number of documents to skip.
batchSizeintThe size of a batch.
secondaryOkboolif set to
truesets the SecondaryOk bit to true in the query message sent to the server.partialOkboolif set to
truethe server is allowed to return partial results if any shards are unavailable.noCursorTimeoutboolif set to
truethe server will not timeout the cursor.oplogReplayboolif set to
truethe OplogReplay bit will be set.tailableCursorboolif set to
truethe query should return a tailable cursor.awaitDataboolif set to
truethe server should await awhile before returning an empty batch for a tailable cursor.serializerIBsonSerializer<TDocument>The serializer.
messageEncoderSettingsMessageEncoderSettingsThe message encoder settings.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<CursorBatch<TDocument>>
A Task whose result is the result of the Insert protocol.
Type Parameters
TDocumentThe type of the document.