Beispiel #1
0
        // methods
        private Task <CursorBatch <TDocument> > ExecuteProtocolAsync(IChannelHandle channel, BsonDocument wrappedQuery, bool slaveOk, CancellationToken cancellationToken)
        {
            var firstBatchSize = QueryHelper.CalculateFirstBatchSize(_limit, _batchSize);

            return(channel.QueryAsync <TDocument>(
                       _collectionNamespace,
                       wrappedQuery,
                       _projection,
                       NoOpElementNameValidator.Instance,
                       _skip ?? 0,
                       firstBatchSize,
                       slaveOk,
                       _allowPartialResults,
                       _noCursorTimeout,
                       _cursorType != CursorType.NonTailable,   // tailable
                       _cursorType == CursorType.TailableAwait, //await data
                       _resultSerializer,
                       _messageEncoderSettings,
                       cancellationToken));
        }
Beispiel #2
0
        // methods
        private CursorBatch <TDocument> ExecuteProtocol(IChannelHandle channel, BsonDocument wrappedQuery, bool slaveOk, CancellationToken cancellationToken)
        {
            var firstBatchSize = QueryHelper.CalculateFirstBatchSize(_limit, _firstBatchSize ?? _batchSize);

#pragma warning disable 618
            return(channel.Query <TDocument>(
                       _collectionNamespace,
                       wrappedQuery,
                       _projection,
                       NoOpElementNameValidator.Instance,
                       _skip ?? 0,
                       firstBatchSize,
                       slaveOk,
                       _allowPartialResults ?? false,
                       _noCursorTimeout ?? false,
                       _oplogReplay ?? false,
                       _cursorType != CursorType.NonTailable,   // tailable
                       _cursorType == CursorType.TailableAwait, //await data
                       _resultSerializer,
                       _messageEncoderSettings,
                       cancellationToken));

#pragma warning restore 618
        }
Beispiel #3
0
        public void CalculateFirstBatchSize_should_return_the_correct_result(int?limit, int?batchSize, int expectedResult)
        {
            var result = QueryHelper.CalculateFirstBatchSize(limit, batchSize);

            result.Should().Be(expectedResult);
        }