Package com.mongodb.operation
Class ParallelCollectionScanOperation<T>
- java.lang.Object
-
- com.mongodb.operation.ParallelCollectionScanOperation<T>
-
- Type Parameters:
T- the operations result type.
- All Implemented Interfaces:
AsyncReadOperation<java.util.List<AsyncBatchCursor<T>>>,ReadOperation<java.util.List<BatchCursor<T>>>
public class ParallelCollectionScanOperation<T> extends java.lang.Object implements AsyncReadOperation<java.util.List<AsyncBatchCursor<T>>>, ReadOperation<java.util.List<BatchCursor<T>>>
Return a list of cursors over the collection that can be used to scan it in parallel.Note: As of MongoDB 2.6, this operation will work against a mongod, but not a mongos.
- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description ParallelCollectionScanOperation(MongoNamespace namespace, int numCursors, Decoder<T> decoder)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParallelCollectionScanOperation<T>batchSize(int batchSize)The batch size to use for each cursor.java.util.List<BatchCursor<T>>execute(ReadBinding binding)General execute which can return anything of type TvoidexecuteAsync(AsyncReadBinding binding, SingleResultCallback<java.util.List<AsyncBatchCursor<T>>> callback)General execute which can return anything of type TintgetBatchSize()Gets the batch size to use for each cursor.intgetNumCursors()Gets the number of cursors requested.
-
-
-
Constructor Detail
-
ParallelCollectionScanOperation
public ParallelCollectionScanOperation(MongoNamespace namespace, int numCursors, Decoder<T> decoder)
Construct a new instance.- Parameters:
namespace- the database and collection namespace for the operation.numCursors- The maximum number of cursors to return. Must be between 1 and 10000, inclusive.decoder- the decoder for the result documents.
-
-
Method Detail
-
getNumCursors
public int getNumCursors()
Gets the number of cursors requested.- Returns:
- number of cursors requested.
-
getBatchSize
public int getBatchSize()
Gets the batch size to use for each cursor. The default value is 0, which tells the server to use its own default batch size.- Returns:
- batch size
-
batchSize
public ParallelCollectionScanOperation<T> batchSize(int batchSize)
The batch size to use for each cursor.- Parameters:
batchSize- the batch size, which must be greater than or equal to 0- Returns:
- this
-
execute
public java.util.List<BatchCursor<T>> execute(ReadBinding binding)
Description copied from interface:ReadOperationGeneral execute which can return anything of type T- Specified by:
executein interfaceReadOperation<T>- Parameters:
binding- the binding to execute in the context of- Returns:
- T, the result of the execution
-
executeAsync
public void executeAsync(AsyncReadBinding binding, SingleResultCallback<java.util.List<AsyncBatchCursor<T>>> callback)
Description copied from interface:AsyncReadOperationGeneral execute which can return anything of type T- Specified by:
executeAsyncin interfaceAsyncReadOperation<T>- Parameters:
binding- the binding to execute in the context ofcallback- the callback to be called when the operation has been executed
-
-