Interface IChannel
Represents a channel (similar to a connection but operates at the level of protocols rather than messages).
public interface IChannel : IDisposable
- Inherited Members
Properties
Connection
Gets the connection.
IConnectionHandle Connection { get; }
Property Value
- IConnectionHandle
The connection.
ConnectionDescription
Gets the connection description.
ConnectionDescription ConnectionDescription { get; }
Property Value
- ConnectionDescription
The connection description.
Methods
CommandAsync<TResult>(ICoreSession, ReadPreference, DatabaseNamespace, BsonDocument, IEnumerable<Type1CommandMessageSection>, IElementNameValidator, BsonDocument, Action<IMessageEncoderPostProcessor>, CommandResponseHandling, IBsonSerializer<TResult>, MessageEncoderSettings, CancellationToken)
Executes a Command protocol.
Task<TResult> CommandAsync<TResult>(ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IEnumerable<Type1CommandMessageSection> commandPayloads, IElementNameValidator commandValidator, BsonDocument additionalOptions, Action<IMessageEncoderPostProcessor> postWriteAction, CommandResponseHandling responseHandling, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
Parameters
sessionICoreSessionThe session.
readPreferenceReadPreferenceThe read preference.
databaseNamespaceDatabaseNamespaceThe database namespace.
commandBsonDocumentThe command.
commandPayloadsIEnumerable<Type1CommandMessageSection>The command payloads.
commandValidatorIElementNameValidatorThe command validator.
additionalOptionsBsonDocumentThe additional options.
postWriteActionAction<IMessageEncoderPostProcessor>The post write action.
responseHandlingCommandResponseHandlingThe response handling.
resultSerializerIBsonSerializer<TResult>The result serializer.
messageEncoderSettingsMessageEncoderSettingsThe message encoder settings.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TResult>
A Task whose result is the result of the Command protocol.
Type Parameters
TResultThe type of the result.
Command<TResult>(ICoreSession, ReadPreference, DatabaseNamespace, BsonDocument, IEnumerable<Type1CommandMessageSection>, IElementNameValidator, BsonDocument, Action<IMessageEncoderPostProcessor>, CommandResponseHandling, IBsonSerializer<TResult>, MessageEncoderSettings, CancellationToken)
Executes a Command protocol.
TResult Command<TResult>(ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IEnumerable<Type1CommandMessageSection> commandPayloads, IElementNameValidator commandValidator, BsonDocument additionalOptions, Action<IMessageEncoderPostProcessor> postWriteAction, CommandResponseHandling responseHandling, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
Parameters
sessionICoreSessionThe session.
readPreferenceReadPreferenceThe read preference.
databaseNamespaceDatabaseNamespaceThe database namespace.
commandBsonDocumentThe command.
commandPayloadsIEnumerable<Type1CommandMessageSection>The command payloads.
commandValidatorIElementNameValidatorThe command validator.
additionalOptionsBsonDocumentThe additional options.
postWriteActionAction<IMessageEncoderPostProcessor>The post write action.
responseHandlingCommandResponseHandlingThe response handling.
resultSerializerIBsonSerializer<TResult>The result serializer.
messageEncoderSettingsMessageEncoderSettingsThe message encoder settings.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- TResult
The result of the Command protocol.
Type Parameters
TResultThe type of the result.
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.
Query<TDocument>(CollectionNamespace, BsonDocument, BsonDocument, IElementNameValidator, int, int, bool, bool, bool, bool, bool, IBsonSerializer<TDocument>, MessageEncoderSettings, CancellationToken)
Executes a Query protocol.
CursorBatch<TDocument> Query<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
- CursorBatch<TDocument>
The result of the Insert protocol.
Type Parameters
TDocumentThe type of the document.
Query<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.")]
CursorBatch<TDocument> Query<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
- CursorBatch<TDocument>
The result of the Insert protocol.
Type Parameters
TDocumentThe type of the document.