T
- the operations result type.public class ParallelCollectionScanOperation<T> extends java.lang.Object implements AsyncReadOperation<java.util.List<AsyncBatchCursor<T>>>, ReadOperation<java.util.List<BatchCursor<T>>>
Note: As of MongoDB 2.6, this operation will work against a mongod, but not a mongos.
Modifier and Type | Field and Description |
---|---|
private int |
batchSize |
private Decoder<T> |
decoder |
private MongoNamespace |
namespace |
private int |
numCursors |
private ReadConcern |
readConcern |
Constructor and Description |
---|
ParallelCollectionScanOperation(MongoNamespace namespace,
int numCursors,
Decoder<T> decoder)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
private CommandOperationHelper.CommandTransformer<BsonDocument,java.util.List<AsyncBatchCursor<T>>> |
asyncTransformer(AsyncConnectionSource source,
AsyncConnection connection) |
ParallelCollectionScanOperation<T> |
batchSize(int batchSize)
The batch size to use for each cursor.
|
private QueryResult<T> |
createQueryResult(BsonDocument cursorDocument,
ServerAddress serverAddress) |
java.util.List<BatchCursor<T>> |
execute(ReadBinding binding)
General execute which can return anything of type T
|
void |
executeAsync(AsyncReadBinding binding,
SingleResultCallback<java.util.List<AsyncBatchCursor<T>>> callback)
General execute which can return anything of type T
|
int |
getBatchSize()
Gets the batch size to use for each cursor.
|
private BsonDocument |
getCommand(SessionContext sessionContext) |
private BsonDocument |
getCursorDocument(BsonDocument cursorDocument) |
private BsonArray |
getCursorDocuments(BsonDocument result) |
int |
getNumCursors()
Gets the number of cursors requested.
|
ReadConcern |
getReadConcern()
Gets the read concern
|
ParallelCollectionScanOperation<T> |
readConcern(ReadConcern readConcern)
Sets the read concern
|
private CommandOperationHelper.CommandTransformer<BsonDocument,java.util.List<BatchCursor<T>>> |
transformer(ConnectionSource source) |
private final MongoNamespace namespace
private final int numCursors
private int batchSize
private ReadConcern readConcern
public ParallelCollectionScanOperation(MongoNamespace namespace, int numCursors, Decoder<T> decoder)
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.public int getNumCursors()
public int getBatchSize()
public ParallelCollectionScanOperation<T> batchSize(int batchSize)
batchSize
- the batch size, which must be greater than or equal to 0public ReadConcern getReadConcern()
public ParallelCollectionScanOperation<T> readConcern(ReadConcern readConcern)
readConcern
- the read concernpublic java.util.List<BatchCursor<T>> execute(ReadBinding binding)
ReadOperation
execute
in interface ReadOperation<java.util.List<BatchCursor<T>>>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncReadBinding binding, SingleResultCallback<java.util.List<AsyncBatchCursor<T>>> callback)
AsyncReadOperation
executeAsync
in interface AsyncReadOperation<java.util.List<AsyncBatchCursor<T>>>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedprivate CommandOperationHelper.CommandTransformer<BsonDocument,java.util.List<BatchCursor<T>>> transformer(ConnectionSource source)
private CommandOperationHelper.CommandTransformer<BsonDocument,java.util.List<AsyncBatchCursor<T>>> asyncTransformer(AsyncConnectionSource source, AsyncConnection connection)
private BsonArray getCursorDocuments(BsonDocument result)
private BsonDocument getCursorDocument(BsonDocument cursorDocument)
private QueryResult<T> createQueryResult(BsonDocument cursorDocument, ServerAddress serverAddress)
private BsonDocument getCommand(SessionContext sessionContext)