File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -35,12 +35,16 @@ public static class Builder {
35
35
36
36
/**
37
37
* 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>
38
41
*
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
40
43
* @return this
41
44
*/
42
45
public Builder numCursors (final int numCursors ) {
43
46
isTrue ("numCursors >= 1" , numCursors >= 1 );
47
+ isTrue ("numCursors <= 10000" , numCursors <= 10000 );
44
48
45
49
this .numCursors = numCursors ;
46
50
return this ;
Original file line number Diff line number Diff line change @@ -550,8 +550,9 @@ public void testParallelScan() throws UnknownHostException {
550
550
collection .insert (new BasicDBObject ("_id" , i ));
551
551
}
552
552
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 );
555
556
556
557
for (Cursor cursor : cursors ) {
557
558
while (cursor .hasNext ()) {
You can’t perform that action at this time.
0 commit comments