Example #1
0
 private CursorBatch <TDocument> GetNextBatch(CancellationToken cancellationToken)
 {
     using (EventContext.BeginOperation(_operationId))
         using (var channel = _channelSource.GetChannel(cancellationToken))
         {
             if (SupportedFeatures.IsFindCommandSupported(channel.ConnectionDescription.ServerVersion))
             {
                 return(ExecuteGetMoreCommand(channel, cancellationToken));
             }
             else
             {
                 return(ExecuteGetMoreProtocol(channel, cancellationToken));
             }
         }
 }
Example #2
0
 private async Task <CursorBatch <TDocument> > GetNextBatchAsync(CancellationToken cancellationToken)
 {
     using (EventContext.BeginOperation(_operationId))
         using (var channel = await _channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false))
         {
             if (SupportedFeatures.IsFindCommandSupported(channel.ConnectionDescription.ServerVersion))
             {
                 return(await ExecuteGetMoreCommandAsync(channel, cancellationToken).ConfigureAwait(false));
             }
             else
             {
                 return(await ExecuteGetMoreProtocolAsync(channel, cancellationToken).ConfigureAwait(false));
             }
         }
 }
        private IReadOperation <IAsyncCursor <TDocument> > CreateOperation(SemanticVersion serverVersion)
        {
            var hasExplainModifier = _modifiers != null && _modifiers.Contains("$explain");

            if (SupportedFeatures.IsFindCommandSupported(serverVersion) && !hasExplainModifier)
            {
                return(CreateFindCommandOperation());
            }
            else
            {
                // this is here because FindOpcodeOperation doesn't support
                // read concern
                _readConcern.ThrowIfNotSupported(serverVersion);
                return(CreateFindOpcodeOperation());
            }
        }