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
session
ICoreSessionThe session.
readPreference
ReadPreferenceThe read preference.
databaseNamespace
DatabaseNamespaceThe database namespace.
command
BsonDocumentThe command.
commandPayloads
IEnumerable<Type1CommandMessageSection>The command payloads.
commandValidator
IElementNameValidatorThe command validator.
additionalOptions
BsonDocumentThe additional options.
postWriteAction
Action<IMessageEncoderPostProcessor>The post write action.
responseHandling
CommandResponseHandlingThe response handling.
resultSerializer
IBsonSerializer<TResult>The result serializer.
messageEncoderSettings
MessageEncoderSettingsThe message encoder settings.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<TResult>
A Task whose result is the result of the Command protocol.
Type Parameters
TResult
The 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
session
ICoreSessionThe session.
readPreference
ReadPreferenceThe read preference.
databaseNamespace
DatabaseNamespaceThe database namespace.
command
BsonDocumentThe command.
commandPayloads
IEnumerable<Type1CommandMessageSection>The command payloads.
commandValidator
IElementNameValidatorThe command validator.
additionalOptions
BsonDocumentThe additional options.
postWriteAction
Action<IMessageEncoderPostProcessor>The post write action.
responseHandling
CommandResponseHandlingThe response handling.
resultSerializer
IBsonSerializer<TResult>The result serializer.
messageEncoderSettings
MessageEncoderSettingsThe message encoder settings.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TResult
The result of the Command protocol.
Type Parameters
TResult
The 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
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.
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
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
- CursorBatch<TDocument>
The result of the Insert protocol.
Type Parameters
TDocument
The 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
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
- CursorBatch<TDocument>
The result of the Insert protocol.
Type Parameters
TDocument
The type of the document.