Package com.mongodb.client
Interface MongoIterable<TResult>
- 
- Type Parameters:
 TResult- The type that this iterable will decode documents to.
- All Superinterfaces:
 java.lang.Iterable<TResult>
- All Known Subinterfaces:
 AggregateIterable<TResult>,ChangeStreamIterable<TResult>,DistinctIterable<TResult>,FindIterable<TResult>,GridFSFindIterable,ListCollectionsIterable<TResult>,ListDatabasesIterable<TResult>,ListIndexesIterable<TResult>,MapReduceIterable<TResult>
@Deprecated(since="2021-05-27") public interface MongoIterable<TResult> extends java.lang.Iterable<TResult>Deprecated.Usage of this API is not supported in AEM as a Cloud Service.The MongoIterable is the results from an operation, such as a query.- Since:
 - 3.0
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description MongoIterable<TResult>batchSize(int batchSize)Deprecated.Sets the number of documents to return per batch.MongoCursor<TResult>cursor()Deprecated.Returns a cursor used for iterating over elements of typeTResult.TResultfirst()Deprecated.Helper to return the first item in the iterator or null.voidforEach(Block<? super TResult> block)Deprecated.PreferIterable.forEach(Consumer), which was added in Java 8<A extends java.util.Collection<? super TResult>>
Ainto(A target)Deprecated.Iterates over all the documents, adding each to the given target.MongoCursor<TResult>iterator()Deprecated.<U> MongoIterable<U>map(Function<TResult,U> mapper)Deprecated.Maps this iterable from the source document type to the target document type. 
 - 
 
- 
- 
Method Detail
- 
iterator
MongoCursor<TResult> iterator()
Deprecated.- Specified by:
 iteratorin interfacejava.lang.Iterable<TResult>
 
- 
cursor
MongoCursor<TResult> cursor()
Deprecated.Returns a cursor used for iterating over elements of typeTResult. The cursor is primarily used for change streams.- Returns:
 - a cursor
 - Since:
 - 3.11
 
 
- 
first
@Nullable TResult first()
Deprecated.Helper to return the first item in the iterator or null.- Returns:
 - T the first item or null.
 
 
- 
map
<U> MongoIterable<U> map(Function<TResult,U> mapper)
Deprecated.Maps this iterable from the source document type to the target document type.- Type Parameters:
 U- the target document type- Parameters:
 mapper- a function that maps from the source to the target document type- Returns:
 - an iterable which maps T to U
 
 
- 
forEach
@Deprecated void forEach(Block<? super TResult> block)
Deprecated.PreferIterable.forEach(Consumer), which was added in Java 8Iterates over all documents in the view, applying the given block to each.Similar to
mapbut the function is fully encapsulated with no returned result.- Parameters:
 block- the block to apply to each document of type T.
 
- 
into
<A extends java.util.Collection<? super TResult>> A into(A target)
Deprecated.Iterates over all the documents, adding each to the given target.- Type Parameters:
 A- the collection type- Parameters:
 target- the collection to insert into- Returns:
 - the target
 
 
- 
batchSize
MongoIterable<TResult> batchSize(int batchSize)
Deprecated.Sets the number of documents to return per batch.- Parameters:
 batchSize- the batch size- Returns:
 - this
 
 
 - 
 
 -