File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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 ()) {
You can’t perform that action at this time.
0 commit comments