private MongoReplyMessage <TDocument> GetMore()
        {
            var connection = AcquireConnection();

            try {
                int numberToReturn;
                if (positiveLimit != 0)
                {
                    numberToReturn = positiveLimit - count;
                    if (cursor.BatchSize != 0 && numberToReturn > cursor.BatchSize)
                    {
                        numberToReturn = cursor.BatchSize;
                    }
                }
                else
                {
                    numberToReturn = cursor.BatchSize;
                }

                using (
                    var message = new MongoGetMoreMessage(
                        cursor.Collection.FullName,
                        numberToReturn,
                        openCursorId
                        )
                    ) {
                    return(GetReply(connection, message));
                }
            } finally {
                cursor.Server.ReleaseConnection(connection);
            }
        }
        private MongoReplyMessage <TDocument> GetMore()
        {
            var connection = AcquireConnection();

            try
            {
                int numberToReturn;
                if (_positiveLimit != 0)
                {
                    numberToReturn = _positiveLimit - _count;
                    if (_cursor.BatchSize != 0 && numberToReturn > _cursor.BatchSize)
                    {
                        numberToReturn = _cursor.BatchSize;
                    }
                }
                else
                {
                    numberToReturn = _cursor.BatchSize;
                }

                var getMoreMessage = new MongoGetMoreMessage(_cursor.Collection.FullName, numberToReturn, _openCursorId);
                return(GetReply(connection, getMoreMessage));
            }
            finally
            {
                _cursor.Server.ReleaseConnection(connection);
            }
        }
Exemple #3
0
        private MongoReplyMessage <TDocument> GetNextBatch()
        {
            var connection = _connectionProvider.AcquireConnection();

            try
            {
                int numberToReturn;
                if (_limit == 0)
                {
                    numberToReturn = _batchSize;
                }
                else
                {
                    var numberToHitLimit = _limit - _count;
                    numberToReturn = (int)Math.Min(_batchSize, numberToHitLimit);
                }

                var getMoreMessage = new MongoGetMoreMessage(_collectionFullName, numberToReturn, _cursorId);
                connection.SendMessage(getMoreMessage);
                return(connection.ReceiveMessage <TDocument>(_readerSettings, _serializer, _serializationOptions));
            }
            finally
            {
                _connectionProvider.ReleaseConnection(connection);
            }
        }
Exemple #4
0
        private MongoReplyMessage <TDocument> GetNextBatch(IConnectionProvider connectionProvider, long cursorId)
        {
            var connection = connectionProvider.AcquireConnection();

            try
            {
                var readerSettings = GetNodeAdjustedReaderSettings(connection.ServerInstance);
                var getMoreMessage = new MongoGetMoreMessage(CollectionFullName, _batchSize, cursorId);
                connection.SendMessage(getMoreMessage);
                return(connection.ReceiveMessage <TDocument>(readerSettings, _serializer, _serializationOptions));
            }
            finally
            {
                connectionProvider.ReleaseConnection(connection);
            }
        }