final class FindIterableImpl<TDocument,TResult> extends MongoIterableImpl<TResult> implements FindIterable<TResult>
Modifier and Type | Field and Description |
---|---|
private CodecRegistry |
codecRegistry |
private java.lang.Class<TDocument> |
documentClass |
private Bson |
filter |
private FindOptions |
findOptions |
private MongoNamespace |
namespace |
private java.lang.Class<TResult> |
resultClass |
Constructor and Description |
---|
FindIterableImpl(ClientSession clientSession,
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 |
---|---|
protected ReadOperation<BatchCursor<TResult>> |
asReadOperation() |
FindIterable<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
FindIterable<TResult> |
collation(Collation collation)
Sets the collation options
|
FindIterable<TResult> |
comment(java.lang.String comment)
Sets the comment to the query.
|
private FindOperation<TResult> |
createQueryOperation() |
FindIterable<TResult> |
cursorType(CursorType cursorType)
Sets the cursor type.
|
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.
|
FindIterable<TResult> |
hint(Bson hint)
Sets the hint for which index to use.
|
FindIterable<TResult> |
limit(int limit)
Sets the limit to apply.
|
FindIterable<TResult> |
max(Bson max)
Sets the exclusive upper bound for a specific index.
|
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> |
maxScan(long maxScan)
Sets the maximum number of documents or index keys to scan when executing the query.
|
FindIterable<TResult> |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
FindIterable<TResult> |
min(Bson min)
Sets the minimum inclusive lower bound for a specific index.
|
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> |
returnKey(boolean returnKey)
Sets the returnKey.
|
FindIterable<TResult> |
showRecordId(boolean showRecordId)
Sets the showRecordId.
|
FindIterable<TResult> |
skip(int skip)
Sets the number of documents to skip.
|
FindIterable<TResult> |
snapshot(boolean snapshot)
Sets the snapshot.
|
FindIterable<TResult> |
sort(Bson sort)
Sets the sort criteria to apply to the query.
|
forEach, getBatchSize, getClientSession, getExecutor, getReadConcern, getReadPreference, into, iterator, map, toBsonDocumentOrNull, toBsonDocumentOrNull
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, into, iterator, map
private final MongoNamespace namespace
private final java.lang.Class<TDocument> documentClass
private final java.lang.Class<TResult> resultClass
private final CodecRegistry codecRegistry
private final FindOptions findOptions
private Bson filter
FindIterableImpl(ClientSession clientSession, 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)
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)
MongoIterable
batchSize
in interface FindIterable<TResult>
batchSize
in interface MongoIterable<TResult>
batchSize
in class MongoIterableImpl<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 FindIterable<TResult> comment(java.lang.String comment)
FindIterable
comment
in interface FindIterable<TResult>
comment
- the commentpublic FindIterable<TResult> hint(Bson hint)
FindIterable
hint
in interface FindIterable<TResult>
hint
- the hintpublic FindIterable<TResult> max(Bson max)
FindIterable
max
in interface FindIterable<TResult>
max
- the maxpublic FindIterable<TResult> min(Bson min)
FindIterable
min
in interface FindIterable<TResult>
min
- the minpublic FindIterable<TResult> maxScan(long maxScan)
FindIterable
maxScan
in interface FindIterable<TResult>
maxScan
- the maxScanpublic FindIterable<TResult> returnKey(boolean returnKey)
FindIterable
returnKey
in interface FindIterable<TResult>
returnKey
- the returnKeypublic FindIterable<TResult> showRecordId(boolean showRecordId)
FindIterable
$recordId
to the returned documents.showRecordId
in interface FindIterable<TResult>
showRecordId
- the showRecordIdpublic FindIterable<TResult> snapshot(boolean snapshot)
FindIterable
snapshot
in interface FindIterable<TResult>
snapshot
- the snapshotpublic TResult first()
MongoIterable
first
in interface MongoIterable<TResult>
first
in class MongoIterableImpl<TResult>
protected ReadOperation<BatchCursor<TResult>> asReadOperation()
asReadOperation
in class MongoIterableImpl<TResult>
private FindOperation<TResult> createQueryOperation()