public final class FindOptions
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
batchSize |
private Collation |
collation |
private java.lang.String |
comment |
private CursorType |
cursorType |
private Bson |
hint |
private int |
limit |
private Bson |
max |
private long |
maxAwaitTimeMS |
private long |
maxScan |
private long |
maxTimeMS |
private Bson |
min |
private Bson |
modifiers |
private boolean |
noCursorTimeout |
private boolean |
oplogReplay |
private boolean |
partial |
private Bson |
projection |
private boolean |
returnKey |
private boolean |
showRecordId |
private int |
skip |
private boolean |
snapshot |
private Bson |
sort |
Constructor and Description |
---|
FindOptions()
Construct a new instance.
|
FindOptions(FindOptions from)
Construct a new instance by making a shallow copy of the given model.
|
Modifier and Type | Method and Description |
---|---|
FindOptions |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
FindOptions |
collation(Collation collation)
Sets the collation options
|
FindOptions |
comment(java.lang.String comment)
Sets the comment to the query.
|
FindOptions |
cursorType(CursorType cursorType)
Sets the cursor type.
|
int |
getBatchSize()
Gets the number of documents to return per batch.
|
Collation |
getCollation()
Returns the collation options
|
java.lang.String |
getComment()
Returns the comment to send with the query.
|
CursorType |
getCursorType()
Get the cursor type.
|
Bson |
getHint()
Returns the hint for which index to use.
|
int |
getLimit()
Gets the limit to apply.
|
Bson |
getMax()
Returns the exclusive upper bound for a specific index.
|
long |
getMaxAwaitTime(java.util.concurrent.TimeUnit timeUnit)
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor
query.
|
long |
getMaxScan()
Returns the maximum number of documents or index keys to scan when executing the query.
|
long |
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
Bson |
getMin()
Returns the minimum inclusive lower bound for a specific index.
|
Bson |
getModifiers()
Deprecated.
use the individual modifier methods instead.
|
Bson |
getProjection()
Gets a document describing the fields to return for all matching documents.
|
int |
getSkip()
Gets the number of documents to skip.
|
Bson |
getSort()
Gets the sort criteria to apply to the query.
|
FindOptions |
hint(Bson hint)
Sets the hint for which index to use.
|
boolean |
isNoCursorTimeout()
The server normally times out idle cursors after an inactivity period (10 minutes)
to prevent excess memory use.
|
boolean |
isOplogReplay()
Users should not set this under normal circumstances.
|
boolean |
isPartial()
Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
|
boolean |
isReturnKey()
Returns the returnKey.
|
boolean |
isShowRecordId()
Returns the showRecordId.
|
boolean |
isSnapshot()
Returns the snapshot.
|
FindOptions |
limit(int limit)
Sets the limit to apply.
|
FindOptions |
max(Bson max)
Sets the exclusive upper bound for a specific index.
|
FindOptions |
maxAwaitTime(long maxAwaitTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum await execution time on the server for this operation.
|
FindOptions |
maxScan(long maxScan)
Sets the maximum number of documents or index keys to scan when executing the query.
|
FindOptions |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
FindOptions |
min(Bson min)
Sets the minimum inclusive lower bound for a specific index.
|
FindOptions |
modifiers(Bson modifiers)
Deprecated.
use the individual modifier methods instead.
|
FindOptions |
noCursorTimeout(boolean noCursorTimeout)
The server normally times out idle cursors after an inactivity period (10 minutes)
to prevent excess memory use.
|
FindOptions |
oplogReplay(boolean oplogReplay)
Users should not set this under normal circumstances.
|
FindOptions |
partial(boolean partial)
Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
|
FindOptions |
projection(Bson projection)
Sets a document describing the fields to return for all matching documents.
|
FindOptions |
returnKey(boolean returnKey)
Sets the returnKey.
|
FindOptions |
showRecordId(boolean showRecordId)
Sets the showRecordId.
|
FindOptions |
skip(int skip)
Sets the number of documents to skip.
|
FindOptions |
snapshot(boolean snapshot)
Sets the snapshot.
|
FindOptions |
sort(Bson sort)
Sets the sort criteria to apply to the query.
|
java.lang.String |
toString() |
private int batchSize
private int limit
private Bson modifiers
private Bson projection
private long maxTimeMS
private long maxAwaitTimeMS
private int skip
private Bson sort
private CursorType cursorType
private boolean noCursorTimeout
private boolean oplogReplay
private boolean partial
private Collation collation
private java.lang.String comment
private Bson hint
private Bson max
private Bson min
private long maxScan
private boolean returnKey
private boolean showRecordId
private boolean snapshot
public FindOptions()
public FindOptions(FindOptions from)
from
- model to copypublic int getLimit()
public FindOptions limit(int limit)
limit
- the limit, which may be nullpublic int getSkip()
public FindOptions skip(int skip)
skip
- the number of documents to skippublic long getMaxTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic FindOptions maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic long getMaxAwaitTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic FindOptions maxAwaitTime(long maxAwaitTime, java.util.concurrent.TimeUnit timeUnit)
maxAwaitTime
- the max await time. A zero value will be ignored, and indicates that the driver should respect the server's
default valuetimeUnit
- the time unit, which may not be nullpublic int getBatchSize()
public FindOptions batchSize(int batchSize)
batchSize
- the batch size@Deprecated public Bson getModifiers()
@Deprecated public FindOptions modifiers(Bson modifiers)
modifiers
- the query modifiers to apply, which may be null.public Bson getProjection()
public FindOptions projection(Bson projection)
projection
- the project document, which may be null.public Bson getSort()
public FindOptions sort(Bson sort)
sort
- the sort criteria, which may be null.public boolean isNoCursorTimeout()
public FindOptions noCursorTimeout(boolean noCursorTimeout)
noCursorTimeout
- true if cursor timeout is disabledpublic boolean isOplogReplay()
public FindOptions oplogReplay(boolean oplogReplay)
oplogReplay
- if oplog replay is enabledpublic boolean isPartial()
public FindOptions partial(boolean partial)
partial
- if partial results for sharded clusters is enabledpublic CursorType getCursorType()
public FindOptions cursorType(CursorType cursorType)
cursorType
- the cursor typepublic Collation getCollation()
public FindOptions collation(Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic java.lang.String getComment()
public FindOptions comment(java.lang.String comment)
comment
- the commentpublic Bson getHint()
public FindOptions hint(Bson hint)
hint
- the hintpublic Bson getMax()
public FindOptions max(Bson max)
max
- the maxpublic Bson getMin()
public FindOptions min(Bson min)
min
- the minpublic long getMaxScan()
public FindOptions maxScan(long maxScan)
maxScan
- the maxScanpublic boolean isReturnKey()
public FindOptions returnKey(boolean returnKey)
returnKey
- the returnKeypublic boolean isShowRecordId()
public FindOptions showRecordId(boolean showRecordId)
$recordId
to the returned documents.showRecordId
- the showRecordIdpublic boolean isSnapshot()
public FindOptions snapshot(boolean snapshot)
snapshot
- the snapshotpublic java.lang.String toString()
toString
in class java.lang.Object