/** * Sets the number of documents to return per batch. * * @param batchSize the batch size * @return this * @mongodb.driver.manual reference/method/cursor.batchSize/#cursor.batchSize Batch Size */ public FindOptions batchSize(final int batchSize) { options.batchSize(batchSize); return this; }
/** * <p>Limits the number of elements returned in one batch. A cursor typically fetches a batch of result objects and store them * locally.</p> * * <p>If {@code batchSize} is positive, it represents the size of each batch of objects retrieved. It can be adjusted to optimize * performance and limit data transfer.</p> * * <p>If {@code batchSize} is negative, it will limit of number objects returned, that fit within the max batch size limit (usually * 4MB), and cursor will be closed. For example if {@code batchSize} is -10, then the server will return a maximum of 10 documents and * as many as can fit in 4MB, then close the cursor. Note that this feature is different from limit() in that documents must fit within * a maximum size, and it removes the need to send a request to close the cursor server-side.</p> * * @param numberOfElements the number of elements to return in a batch * @return {@code this} so calls can be chained */ public DBCursor batchSize(final int numberOfElements) { findOptions.batchSize(numberOfElements); return this; }
/** * Copy this DBCollectionFindOptions instance into a new instance. * * @return the new DBCollectionFindOptions with the same settings as this instance. */ public DBCollectionFindOptions copy() { DBCollectionFindOptions copiedOptions = new DBCollectionFindOptions(); copiedOptions.batchSize(batchSize); copiedOptions.limit(limit); copiedOptions.modifiers(modifiers); copiedOptions.projection(projection); copiedOptions.maxTime(maxTimeMS, TimeUnit.MILLISECONDS); copiedOptions.maxAwaitTime(maxAwaitTimeMS, TimeUnit.MILLISECONDS); copiedOptions.skip(skip); copiedOptions.sort(sort); copiedOptions.cursorType(cursorType); copiedOptions.noCursorTimeout(noCursorTimeout); copiedOptions.oplogReplay(oplogReplay); copiedOptions.partial(partial); copiedOptions.readPreference(readPreference); copiedOptions.readConcern(readConcern); copiedOptions.collation(collation); copiedOptions.comment(comment); copiedOptions.hint(hint); copiedOptions.max(max); copiedOptions.min(min); copiedOptions.returnKey(returnKey); copiedOptions.showRecordId(showRecordId); return copiedOptions; }
/** * Sets the number of documents to return per batch. * * @param batchSize the batch size * @return this * @mongodb.driver.manual reference/method/cursor.batchSize/#cursor.batchSize Batch Size */ public FindOptions batchSize(final int batchSize) { options.batchSize(batchSize); return this; }
/** * <p>Limits the number of elements returned in one batch. A cursor typically fetches a batch of result objects and store them * locally.</p> * * <p>If {@code batchSize} is positive, it represents the size of each batch of objects retrieved. It can be adjusted to optimize * performance and limit data transfer.</p> * * <p>If {@code batchSize} is negative, it will limit of number objects returned, that fit within the max batch size limit (usually * 4MB), and cursor will be closed. For example if {@code batchSize} is -10, then the server will return a maximum of 10 documents and * as many as can fit in 4MB, then close the cursor. Note that this feature is different from limit() in that documents must fit within * a maximum size, and it removes the need to send a request to close the cursor server-side.</p> * * @param numberOfElements the number of elements to return in a batch * @return {@code this} so calls can be chained */ public DBCursor batchSize(final int numberOfElements) { findOptions.batchSize(numberOfElements); return this; }
/** * Copy this DBCollectionFindOptions instance into a new instance. * * @return the new DBCollectionFindOptions with the same settings as this instance. */ public DBCollectionFindOptions copy() { DBCollectionFindOptions copiedOptions = new DBCollectionFindOptions(); copiedOptions.batchSize(batchSize); copiedOptions.limit(limit); copiedOptions.modifiers(modifiers); copiedOptions.projection(projection); copiedOptions.maxTime(maxTimeMS, TimeUnit.MILLISECONDS); copiedOptions.maxAwaitTime(maxAwaitTimeMS, TimeUnit.MILLISECONDS); copiedOptions.skip(skip); copiedOptions.sort(sort); copiedOptions.cursorType(cursorType); copiedOptions.noCursorTimeout(noCursorTimeout); copiedOptions.oplogReplay(oplogReplay); copiedOptions.partial(partial); copiedOptions.readPreference(readPreference); copiedOptions.readConcern(readConcern); copiedOptions.collation(collation); copiedOptions.comment(comment); copiedOptions.hint(hint); copiedOptions.max(max); copiedOptions.min(min); copiedOptions.returnKey(returnKey); copiedOptions.showRecordId(showRecordId); return copiedOptions; }