TResult
- The type that this iterable will decode documents to.Iterable<TResult>
AggregateIterable<TResult>
, ChangeStreamIterable<TResult>
, DistinctIterable<TResult>
, FindIterable<TResult>
, GridFSFindIterable
, ListCollectionsIterable<TResult>
, ListDatabasesIterable<TResult>
, ListIndexesIterable<TResult>
, MapReduceIterable<TResult>
public interface MongoIterable<TResult> extends Iterable<TResult>
Modifier and Type | Method | Description |
---|---|---|
MongoIterable<TResult> |
batchSize(int batchSize) |
Sets the number of documents to return per batch.
|
TResult |
first() |
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super TResult> block) |
Iterates over all documents in the view, applying the given block to each.
|
<A extends Collection<? super TResult>> |
into(A target) |
Iterates over all the documents, adding each to the given target.
|
MongoCursor<TResult> |
iterator() |
|
<U> MongoIterable<U> |
map(Function<TResult,U> mapper) |
Maps this iterable from the source document type to the target document type.
|
forEach, spliterator
MongoCursor<TResult> iterator()
@Nullable TResult first()
<U> MongoIterable<U> map(Function<TResult,U> mapper)
U
- the target document typemapper
- a function that maps from the source to the target document typevoid forEach(Block<? super TResult> block)
Similar to map
but the function is fully encapsulated with no returned result.
block
- the block to apply to each document of type T.<A extends Collection<? super TResult>> A into(A target)
A
- the collection typetarget
- the collection to insert intoMongoIterable<TResult> batchSize(int batchSize)
batchSize
- the batch size