Skip to content

Commit 59d35a7

Browse files
committed
Updated docs and testcase for ParallelScan
Small documentation clarification and testcase update JAVA-1105
1 parent 04237c7 commit 59d35a7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/main/com/mongodb/ParallelScanOptions.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ public static class Builder {
3535

3636
/**
3737
* Set the requested number of cursors to iterate in parallel.
38+
* <p>
39+
* Note: this is the maximum number of cursors the server will return, it may return fewer cursors.
40+
* </p>
3841
*
39-
* @param numCursors the number of cursors requested, which must be >= 1
42+
* @param numCursors the number of cursors requested, which must be >= 1 and <= 10000
4043
* @return this
4144
*/
4245
public Builder numCursors(final int numCursors) {
4346
isTrue("numCursors >= 1", numCursors >= 1);
47+
isTrue("numCursors <= 10000", numCursors <= 10000);
4448

4549
this.numCursors = numCursors;
4650
return this;

src/test/com/mongodb/DBCollectionTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,9 @@ public void testParallelScan() throws UnknownHostException {
550550
collection.insert(new BasicDBObject("_id", i));
551551
}
552552

553-
List<Cursor> cursors = collection.parallelScan(ParallelScanOptions.builder().numCursors(3).batchSize(1000).build());
554-
assertEquals(3, cursors.size());
553+
int numCursors = 10;
554+
List<Cursor> cursors = collection.parallelScan(ParallelScanOptions.builder().numCursors(numCursors).batchSize(1000).build());
555+
assertTrue(cursors.size() <= numCursors);
555556

556557
for (Cursor cursor : cursors) {
557558
while (cursor.hasNext()) {

0 commit comments

Comments
 (0)