T - the return type of the map reduceclass OperationIterable<T> extends java.lang.Object implements MongoIterable<T>
| Modifier and Type | Field and Description |
|---|---|
private OperationExecutor |
executor |
private ReadOperation<? extends BatchCursor<T>> |
operation |
private ReadPreference |
readPreference |
| Constructor and Description |
|---|
OperationIterable(ReadOperation<? extends BatchCursor<T>> operation,
ReadPreference readPreference,
OperationExecutor executor) |
| Modifier and Type | Method and Description |
|---|---|
MongoIterable<T> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
T |
first()
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super T> block)
Iterates over all documents in the view, applying the given block to each.
|
<A extends java.util.Collection<? super T>> |
into(A target)
Iterates over all the documents, adding each to the given target.
|
MongoCursor<T> |
iterator() |
<U> MongoIterable<U> |
map(Function<T,U> mapper)
Maps this iterable from the source document type to the target document type.
|
private final ReadOperation<? extends BatchCursor<T>> operation
private final ReadPreference readPreference
private final OperationExecutor executor
OperationIterable(ReadOperation<? extends BatchCursor<T>> operation, ReadPreference readPreference, OperationExecutor executor)
public MongoCursor<T> iterator()
iterator in interface MongoIterable<T>iterator in interface java.lang.Iterable<T>public T first()
MongoIterablefirst in interface MongoIterable<T>public <U> MongoIterable<U> map(Function<T,U> mapper)
MongoIterablemap in interface MongoIterable<T>U - the target document typemapper - a function that maps from the source to the target document typepublic void forEach(Block<? super T> block)
MongoIterableSimilar to map but the function is fully encapsulated with no returned result.
forEach in interface MongoIterable<T>block - the block to apply to each document of type T.public <A extends java.util.Collection<? super T>> A into(A target)
MongoIterableinto in interface MongoIterable<T>A - the collection typetarget - the collection to insert intopublic MongoIterable<T> batchSize(int batchSize)
MongoIterablebatchSize in interface MongoIterable<T>batchSize - the batch size