final 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 |
---|---|
void |
batchCursor(SingleResultCallback<AsyncBatchCursor<GridFSFile>> callback)
Provide the underlying
AsyncBatchCursor allowing fine grained control of the cursor. |
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.
|
void |
first(SingleResultCallback<GridFSFile> callback)
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super GridFSFile> block,
SingleResultCallback<java.lang.Void> callback)
Iterates over all documents in the view, applying the given block to each, and completing the returned future after all documents
have been iterated, or an exception has occurred.
|
<A extends java.util.Collection<? super GridFSFile>> |
into(A target,
SingleResultCallback<A> callback)
Iterates over all the documents, adding each to the given target.
|
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
public 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 noCursorTimeout(boolean noCursorTimeout)
GridFSFindIterable
noCursorTimeout
in interface GridFSFindIterable
noCursorTimeout
- true if cursor timeout is disabledpublic void first(SingleResultCallback<GridFSFile> callback)
MongoIterable
first
in interface MongoIterable<GridFSFile>
callback
- a callback that is passed the first item or null.public void forEach(Block<? super GridFSFile> block, SingleResultCallback<java.lang.Void> callback)
MongoIterable
forEach
in interface MongoIterable<GridFSFile>
block
- the block to apply to each documentcallback
- a callback that completed once the iteration has completedpublic <A extends java.util.Collection<? super GridFSFile>> void into(A target, SingleResultCallback<A> callback)
MongoIterable
into
in interface MongoIterable<GridFSFile>
A
- the collection typetarget
- the collection to insert intocallback
- a callback that will be passed the target containing all documentspublic <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 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 void batchCursor(SingleResultCallback<AsyncBatchCursor<GridFSFile>> callback)
MongoIterable
AsyncBatchCursor
allowing fine grained control of the cursor.batchCursor
in interface MongoIterable<GridFSFile>
callback
- a callback that will be passed the AsyncBatchCursor