final class FindIterableImpl<TDocument,TResult> extends java.lang.Object implements FindIterable<TResult>
| Modifier and Type | Class and Description |
|---|---|
private class |
FindIterableImpl.FindOperationIterable |
| Modifier and Type | Field and Description |
|---|---|
private CodecRegistry |
codecRegistry |
private java.lang.Class<TDocument> |
documentClass |
private OperationExecutor |
executor |
private Bson |
filter |
private FindOptions |
findOptions |
private MongoNamespace |
namespace |
private ReadConcern |
readConcern |
private ReadPreference |
readPreference |
private java.lang.Class<TResult> |
resultClass |
| Constructor and Description |
|---|
FindIterableImpl(MongoNamespace namespace,
java.lang.Class<TDocument> documentClass,
java.lang.Class<TResult> resultClass,
CodecRegistry codecRegistry,
ReadPreference readPreference,
ReadConcern readConcern,
OperationExecutor executor,
Bson filter,
FindOptions findOptions) |
| Modifier and Type | Method and Description |
|---|---|
FindIterable<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
FindIterable<TResult> |
collation(Collation collation)
Sets the collation options
|
private FindOperation<TResult> |
createQueryOperation() |
FindIterable<TResult> |
cursorType(CursorType cursorType)
Sets the cursor type.
|
private MongoIterable<TResult> |
execute() |
FindIterable<TResult> |
filter(Bson filter)
Sets the query filter to apply to the query.
|
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 java.util.Collection<? super TResult>> |
into(A target)
Iterates over all the documents, adding each to the given target.
|
MongoCursor<TResult> |
iterator() |
FindIterable<TResult> |
limit(int limit)
Sets the limit to apply.
|
<U> MongoIterable<U> |
map(Function<TResult,U> mapper)
Maps this iterable from the source document type to the target document type.
|
FindIterable<TResult> |
maxAwaitTime(long maxAwaitTime,
java.util.concurrent.TimeUnit timeUnit)
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor
query.
|
FindIterable<TResult> |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
FindIterable<TResult> |
modifiers(Bson modifiers)
Sets the query modifiers to apply to this operation.
|
FindIterable<TResult> |
noCursorTimeout(boolean noCursorTimeout)
The server normally times out idle cursors after an inactivity period (10 minutes)
to prevent excess memory use.
|
FindIterable<TResult> |
oplogReplay(boolean oplogReplay)
Users should not set this under normal circumstances.
|
FindIterable<TResult> |
partial(boolean partial)
Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
|
FindIterable<TResult> |
projection(Bson projection)
Sets a document describing the fields to return for all matching documents.
|
FindIterable<TResult> |
skip(int skip)
Sets the number of documents to skip.
|
FindIterable<TResult> |
sort(Bson sort)
Sets the sort criteria to apply to the query.
|
private BsonDocument |
toBsonDocument(Bson document) |
private final MongoNamespace namespace
private final java.lang.Class<TDocument> documentClass
private final java.lang.Class<TResult> resultClass
private final ReadPreference readPreference
private final ReadConcern readConcern
private final CodecRegistry codecRegistry
private final OperationExecutor executor
private final FindOptions findOptions
private Bson filter
FindIterableImpl(MongoNamespace namespace, java.lang.Class<TDocument> documentClass, java.lang.Class<TResult> resultClass, CodecRegistry codecRegistry, ReadPreference readPreference, ReadConcern readConcern, OperationExecutor executor, Bson filter, FindOptions findOptions)
public FindIterable<TResult> filter(Bson filter)
FindIterablefilter in interface FindIterable<TResult>filter - the filter, which may be null.public FindIterable<TResult> limit(int limit)
FindIterablelimit in interface FindIterable<TResult>limit - the limit, which may be nullpublic FindIterable<TResult> skip(int skip)
FindIterableskip in interface FindIterable<TResult>skip - the number of documents to skippublic FindIterable<TResult> maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
FindIterablemaxTime in interface FindIterable<TResult>maxTime - the max timetimeUnit - the time unit, which may not be nullpublic FindIterable<TResult> maxAwaitTime(long maxAwaitTime, java.util.concurrent.TimeUnit timeUnit)
FindIterablemaxAwaitTime in interface FindIterable<TResult>maxAwaitTime - the max await timetimeUnit - the time unit to return the result inpublic FindIterable<TResult> batchSize(int batchSize)
FindIterablebatchSize in interface FindIterable<TResult>batchSize in interface MongoIterable<TResult>batchSize - the batch sizepublic FindIterable<TResult> collation(Collation collation)
FindIterableA null value represents the server default.
collation in interface FindIterable<TResult>collation - the collation options to usepublic FindIterable<TResult> modifiers(Bson modifiers)
FindIterablemodifiers in interface FindIterable<TResult>modifiers - the query modifiers to apply, which may be null.public FindIterable<TResult> projection(Bson projection)
FindIterableprojection in interface FindIterable<TResult>projection - the project document, which may be null.public FindIterable<TResult> sort(Bson sort)
FindIterablesort in interface FindIterable<TResult>sort - the sort criteria, which may be null.public FindIterable<TResult> noCursorTimeout(boolean noCursorTimeout)
FindIterablenoCursorTimeout in interface FindIterable<TResult>noCursorTimeout - true if cursor timeout is disabledpublic FindIterable<TResult> oplogReplay(boolean oplogReplay)
FindIterableoplogReplay in interface FindIterable<TResult>oplogReplay - if oplog replay is enabledpublic FindIterable<TResult> partial(boolean partial)
FindIterablepartial in interface FindIterable<TResult>partial - if partial results for sharded clusters is enabledpublic FindIterable<TResult> cursorType(CursorType cursorType)
FindIterablecursorType in interface FindIterable<TResult>cursorType - the cursor typepublic MongoCursor<TResult> iterator()
iterator in interface MongoIterable<TResult>iterator in interface java.lang.Iterable<TResult>public TResult first()
MongoIterablefirst in interface MongoIterable<TResult>public <U> MongoIterable<U> map(Function<TResult,U> mapper)
MongoIterablemap in interface MongoIterable<TResult>U - the target document typemapper - a function that maps from the source to the target document typepublic void forEach(Block<? super TResult> block)
MongoIterableSimilar to map but the function is fully encapsulated with no returned result.
forEach in interface MongoIterable<TResult>block - the block to apply to each document of type T.public <A extends java.util.Collection<? super TResult>> A into(A target)
MongoIterableinto in interface MongoIterable<TResult>A - the collection typetarget - the collection to insert intoprivate MongoIterable<TResult> execute()
private FindOperation<TResult> createQueryOperation()
private BsonDocument toBsonDocument(Bson document)