final class CursorHelper
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
CursorHelper() |
Modifier and Type | Method and Description |
---|---|
(package private) static BsonDocument |
getCursorDocumentFromBatchSize(java.lang.Integer batchSize) |
(package private) static int |
getNumberToReturn(int limit,
int batchSize,
int numReturnedSoFar)
Gets the limit of the number of documents in the OP_REPLY response to the get more request.
|
static int getNumberToReturn(int limit, int batchSize, int numReturnedSoFar)
Gets the limit of the number of documents in the OP_REPLY response to the get more request. A value of zero tells the server to use the default size. A negative value tells the server to return no more than that number and immediately close the cursor. Otherwise, the server will return no more than that number and return the same cursorId to allow the rest of the documents to be fetched, if it turns out there are more documents.
The value returned by this method is based on the limit, the batch size, both of which can be positive, negative, or zero, and the number of documents fetched so far.
limit
- the user-specified limit on the number of results returnedbatchSize
- the user-specified batch sizenumReturnedSoFar
- the number of results returned so farstatic BsonDocument getCursorDocumentFromBatchSize(java.lang.Integer batchSize)