public final class FindOptions
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
batchSize |
private Collation |
collation |
private CursorType |
cursorType |
private int |
limit |
private long |
maxAwaitTimeMS |
private long |
maxTimeMS |
private Bson |
modifiers |
private boolean |
noCursorTimeout |
private boolean |
oplogReplay |
private boolean |
partial |
private Bson |
projection |
private int |
skip |
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 |
cursorType(CursorType cursorType)
Sets the cursor type.
|
int |
getBatchSize()
Gets the number of documents to return per batch.
|
Collation |
getCollation()
Returns the collation options
|
CursorType |
getCursorType()
Get the cursor type.
|
int |
getLimit()
Gets the limit to apply.
|
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 |
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
Bson |
getModifiers()
Gets the query modifiers to apply to this operation.
|
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.
|
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).
|
FindOptions |
limit(int limit)
Sets the limit to apply.
|
FindOptions |
maxAwaitTime(long maxAwaitTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum await execution time on the server for this operation.
|
FindOptions |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
FindOptions |
modifiers(Bson modifiers)
Sets the query modifiers to apply to this operation.
|
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 |
skip(int skip)
Sets the number of documents to skip.
|
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
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 sizepublic Bson getModifiers()
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 toString()
toString
in class java.lang.Object