class GridFSFindIterableImpl extends java.lang.Object implements GridFSFindIterable
Modifier and Type | Field and Description |
---|---|
private FindIterable<GridFSFile> |
underlying |
Constructor and Description |
---|
GridFSFindIterableImpl(FindIterable<GridFSFile> underlying) |
Modifier and Type | Method and Description |
---|---|
GridFSFindIterable |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
GridFSFindIterable |
collation(Collation collation)
Sets the collation options
|
GridFSFindIterable |
filter(Bson filter)
Sets the query filter to apply to the query.
|
GridFSFile |
first()
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super GridFSFile> block)
Iterates over all documents in the view, applying the given block to each.
|
<A extends java.util.Collection<? super GridFSFile>> |
into(A target)
Iterates over all the documents, adding each to the given target.
|
MongoCursor<GridFSFile> |
iterator() |
GridFSFindIterable |
limit(int limit)
Sets the limit to apply.
|
<U> MongoIterable<U> |
map(Function<GridFSFile,U> mapper)
Maps this iterable from the source document type to the target document type.
|
GridFSFindIterable |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
GridFSFindIterable |
noCursorTimeout(boolean noCursorTimeout)
The server normally times out idle cursors after an inactivity period (10 minutes)
to prevent excess memory use.
|
GridFSFindIterable |
skip(int skip)
Sets the number of documents to skip.
|
GridFSFindIterable |
sort(Bson sort)
Sets the sort criteria to apply to the query.
|
private final FindIterable<GridFSFile> underlying
GridFSFindIterableImpl(FindIterable<GridFSFile> underlying)
public GridFSFindIterable sort(Bson sort)
GridFSFindIterable
sort
in interface GridFSFindIterable
sort
- the sort criteria, which may be null.public GridFSFindIterable skip(int skip)
GridFSFindIterable
skip
in interface GridFSFindIterable
skip
- the number of documents to skippublic GridFSFindIterable limit(int limit)
GridFSFindIterable
limit
in interface GridFSFindIterable
limit
- the limit, which may be nullpublic GridFSFindIterable filter(Bson filter)
GridFSFindIterable
Below is an example of filtering against the filename and some nested metadata that can also be stored along with the file data:
Filters.and(Filters.eq("filename", "mongodb.png"), Filters.eq("metadata.contentType", "image/png"));
filter
in interface GridFSFindIterable
filter
- the filter, which may be null.Filters
public GridFSFindIterable maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
GridFSFindIterable
maxTime
in interface GridFSFindIterable
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic GridFSFindIterable batchSize(int batchSize)
GridFSFindIterable
batchSize
in interface GridFSFindIterable
batchSize
in interface MongoIterable<GridFSFile>
batchSize
- the batch sizepublic GridFSFindIterable collation(Collation collation)
GridFSFindIterable
A null value represents the server default.
collation
in interface GridFSFindIterable
collation
- the collation options to usepublic GridFSFindIterable noCursorTimeout(boolean noCursorTimeout)
GridFSFindIterable
noCursorTimeout
in interface GridFSFindIterable
noCursorTimeout
- true if cursor timeout is disabledpublic MongoCursor<GridFSFile> iterator()
iterator
in interface MongoIterable<GridFSFile>
iterator
in interface java.lang.Iterable<GridFSFile>
public GridFSFile first()
MongoIterable
first
in interface MongoIterable<GridFSFile>
public <U> MongoIterable<U> map(Function<GridFSFile,U> mapper)
MongoIterable
map
in interface MongoIterable<GridFSFile>
U
- the target document typemapper
- a function that maps from the source to the target document typepublic void forEach(Block<? super GridFSFile> block)
MongoIterable
Similar to map
but the function is fully encapsulated with no returned result.
forEach
in interface MongoIterable<GridFSFile>
block
- the block to apply to each document of type T.public <A extends java.util.Collection<? super GridFSFile>> A into(A target)
MongoIterable
into
in interface MongoIterable<GridFSFile>
A
- the collection typetarget
- the collection to insert into