class FindIterableImpl<TDocument,TResult> extends java.lang.Object implements FindIterable<TResult>
Modifier and Type | Field and Description |
---|---|
private CodecRegistry |
codecRegistry |
private java.lang.Class<TDocument> |
documentClass |
private AsyncOperationExecutor |
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,
AsyncOperationExecutor executor,
Bson filter,
FindOptions findOptions) |
Modifier and Type | Method and Description |
---|---|
void |
batchCursor(SingleResultCallback<AsyncBatchCursor<TResult>> callback)
Provide the underlying
AsyncBatchCursor allowing fine grained control of the cursor. |
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() |
private MongoIterable<TResult> |
execute(FindOperation<TResult> operation) |
FindIterable<TResult> |
filter(Bson filter)
Sets the query filter to apply to the query.
|
void |
first(SingleResultCallback<TResult> callback)
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super TResult> 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 TResult>> |
into(A target,
SingleResultCallback<A> callback)
Iterates over all the documents, adding each to the given target.
|
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 AsyncOperationExecutor 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, AsyncOperationExecutor executor, Bson filter, FindOptions findOptions)
public FindIterable<TResult> filter(Bson filter)
FindIterable
filter
in interface FindIterable<TResult>
filter
- the filter, which may be null.public FindIterable<TResult> limit(int limit)
FindIterable
limit
in interface FindIterable<TResult>
limit
- the limit, which may be nullpublic FindIterable<TResult> skip(int skip)
FindIterable
skip
in interface FindIterable<TResult>
skip
- the number of documents to skippublic FindIterable<TResult> maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
FindIterable
maxTime
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)
FindIterable
maxAwaitTime
in interface FindIterable<TResult>
maxAwaitTime
- the max await timetimeUnit
- the time unit to return the result inpublic FindIterable<TResult> batchSize(int batchSize)
FindIterable
batchSize
in interface FindIterable<TResult>
batchSize
in interface MongoIterable<TResult>
batchSize
- the batch sizepublic FindIterable<TResult> collation(Collation collation)
FindIterable
A null value represents the server default.
collation
in interface FindIterable<TResult>
collation
- the collation options to usepublic FindIterable<TResult> modifiers(Bson modifiers)
FindIterable
modifiers
in interface FindIterable<TResult>
modifiers
- the query modifiers to apply, which may be null.public FindIterable<TResult> projection(Bson projection)
FindIterable
projection
in interface FindIterable<TResult>
projection
- the project document, which may be null.public FindIterable<TResult> sort(Bson sort)
FindIterable
sort
in interface FindIterable<TResult>
sort
- the sort criteria, which may be null.public FindIterable<TResult> noCursorTimeout(boolean noCursorTimeout)
FindIterable
noCursorTimeout
in interface FindIterable<TResult>
noCursorTimeout
- true if cursor timeout is disabledpublic FindIterable<TResult> oplogReplay(boolean oplogReplay)
FindIterable
oplogReplay
in interface FindIterable<TResult>
oplogReplay
- if oplog replay is enabledpublic FindIterable<TResult> partial(boolean partial)
FindIterable
partial
in interface FindIterable<TResult>
partial
- if partial results for sharded clusters is enabledpublic FindIterable<TResult> cursorType(CursorType cursorType)
FindIterable
cursorType
in interface FindIterable<TResult>
cursorType
- the cursor typepublic void first(SingleResultCallback<TResult> callback)
MongoIterable
first
in interface MongoIterable<TResult>
callback
- a callback that is passed the first item or null.public void forEach(Block<? super TResult> block, SingleResultCallback<java.lang.Void> callback)
MongoIterable
forEach
in interface MongoIterable<TResult>
block
- the block to apply to each documentcallback
- a callback that completed once the iteration has completedpublic <A extends java.util.Collection<? super TResult>> void into(A target, SingleResultCallback<A> callback)
MongoIterable
into
in interface MongoIterable<TResult>
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<TResult,U> mapper)
MongoIterable
map
in interface MongoIterable<TResult>
U
- the target document typemapper
- a function that maps from the source to the target document typepublic void batchCursor(SingleResultCallback<AsyncBatchCursor<TResult>> callback)
MongoIterable
AsyncBatchCursor
allowing fine grained control of the cursor.batchCursor
in interface MongoIterable<TResult>
callback
- a callback that will be passed the AsyncBatchCursorprivate MongoIterable<TResult> execute()
private MongoIterable<TResult> execute(FindOperation<TResult> operation)
private FindOperation<TResult> createQueryOperation()
private BsonDocument toBsonDocument(Bson document)