public final class FindOptions
extends java.lang.Object
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()
Deprecated.
Deprecated as of MongoDB 4.0 release
|
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()
Deprecated.
Deprecated in MongoDB 3.6 release and removed in MongoDB 4.0 release
|
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)
Deprecated.
Deprecated as of MongoDB 4.0 release
|
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)
Deprecated.
Deprecated in MongoDB 3.6 release and removed in MongoDB 4.0 release
|
FindOptions |
sort(Bson sort)
Sets the sort criteria to apply to the query.
|
java.lang.String |
toString() |
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 @Nullable public Bson getModifiers()
@Deprecated public FindOptions modifiers(@Nullable Bson modifiers)
modifiers
- the query modifiers to apply, which may be null.@Nullable public Bson getProjection()
public FindOptions projection(@Nullable Bson projection)
projection
- the project document, which may be null.@Nullable public Bson getSort()
public FindOptions sort(@Nullable 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 type@Nullable public Collation getCollation()
public FindOptions collation(@Nullable Collation collation)
A null value represents the server default.
collation
- the collation options to use@Nullable public java.lang.String getComment()
public FindOptions comment(@Nullable java.lang.String comment)
comment
- the comment@Nullable public Bson getHint()
public FindOptions hint(@Nullable Bson hint)
hint
- the hint@Nullable public Bson getMax()
public FindOptions max(@Nullable Bson max)
max
- the max@Nullable public Bson getMin()
public FindOptions min(@Nullable Bson min)
min
- the min@Deprecated public long getMaxScan()
@Deprecated 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 showRecordId@Deprecated public boolean isSnapshot()
@Deprecated public FindOptions snapshot(boolean snapshot)
snapshot
- the snapshotpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved