Package io.vertx.mongo.client
Class FindOptions
- java.lang.Object
-
- io.vertx.mongo.client.FindOptions
-
public class FindOptions extends java.lang.Object
Options for find.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description FindOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Integer
getBatchSize()
Collation
getCollation()
java.lang.String
getComment()
CursorType
getCursorType()
JsonObject
getFilter()
JsonObject
getHint()
java.lang.String
getHintString()
java.lang.Integer
getLimit()
JsonObject
getMax()
java.lang.Long
getMaxAwaitTime()
java.lang.Long
getMaxTime()
JsonObject
getMin()
JsonObject
getProjection()
java.lang.Integer
getSkip()
JsonObject
getSort()
java.lang.Boolean
isAllowDiskUse()
java.lang.Boolean
isNoCursorTimeout()
java.lang.Boolean
isOplogReplay()
Deprecated.java.lang.Boolean
isPartial()
java.lang.Boolean
isReturnKey()
java.lang.Boolean
isShowRecordId()
FindOptions
setAllowDiskUse(java.lang.Boolean allowDiskUse)
Enables writing to temporary files on the server.FindOptions
setBatchSize(java.lang.Integer batchSize)
Sets the number of documents to return per batch.FindOptions
setCollation(Collation collation)
Sets the collation optionsFindOptions
setComment(java.lang.String comment)
Sets the comment to the query.FindOptions
setCursorType(CursorType cursorType)
Sets the cursor type.FindOptions
setFilter(JsonObject filter)
Sets the query filter to apply to the query.FindOptions
setHint(JsonObject hint)
Sets the hint for which index to use.FindOptions
setHintString(java.lang.String hint)
Sets the hint for which index to use.FindOptions
setLimit(java.lang.Integer limit)
Sets the limit to apply.FindOptions
setMax(JsonObject max)
Sets the exclusive upper bound for a specific index.FindOptions
setMaxAwaitTime(java.lang.Long maxAwaitTime)
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.FindOptions
setMaxTime(java.lang.Long maxTime)
Sets the maximum execution time on the server for this operation.FindOptions
setMin(JsonObject min)
Sets the minimum inclusive lower bound for a specific index.FindOptions
setNoCursorTimeout(java.lang.Boolean noCursorTimeout)
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use.FindOptions
setOplogReplay(java.lang.Boolean oplogReplay)
Deprecated.oplogReplay has been deprecated in MongoDB 4.4.FindOptions
setPartial(java.lang.Boolean partial)
Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).FindOptions
setProjection(JsonObject projection)
Sets a document describing the fields to return for all matching documents.FindOptions
setReturnKey(java.lang.Boolean returnKey)
Sets the returnKey.FindOptions
setShowRecordId(java.lang.Boolean showRecordId)
Sets the showRecordId.FindOptions
setSkip(java.lang.Integer skip)
Sets the number of documents to skip.FindOptions
setSort(JsonObject sort)
Sets the sort criteria to apply to the query.
-
-
-
Method Detail
-
setFilter
public FindOptions setFilter(JsonObject filter)
Sets the query filter to apply to the query.- Parameters:
filter
- the filter, which may be null.- Returns:
- this
- MongoDB documentation
- Filter
-
getFilter
public JsonObject getFilter()
-
setLimit
public FindOptions setLimit(java.lang.Integer limit)
Sets the limit to apply.- Parameters:
limit
- the limit- Returns:
- this
- MongoDB documentation
- Limit
-
getLimit
public java.lang.Integer getLimit()
-
setSkip
public FindOptions setSkip(java.lang.Integer skip)
Sets the number of documents to skip.- Parameters:
skip
- the number of documents to skip- Returns:
- this
- MongoDB documentation
- Skip
-
getSkip
public java.lang.Integer getSkip()
-
setMaxTime
public FindOptions setMaxTime(java.lang.Long maxTime)
Sets the maximum execution time on the server for this operation.- Parameters:
maxTime
- the max time (in milliseconds)- Returns:
- this
- MongoDB documentation
- Max Time
-
getMaxTime
public java.lang.Long getMaxTime()
-
setMaxAwaitTime
public FindOptions setMaxAwaitTime(java.lang.Long maxAwaitTime)
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored. On servers >= 3.2, this option will be specified on the getMore command as "maxTimeMS". The default is no value: no "maxTimeMS" is sent to the server with the getMore command. On servers < 3.2, this option is ignored, and indicates that the driver should respect the server's default value A zero value will be ignored.- Parameters:
maxAwaitTime
- the max await time (in milliseconds)- Returns:
- the maximum await execution time in the given time unit
- Since:
- 1.2
- MongoDB documentation
- Max Time
-
getMaxAwaitTime
public java.lang.Long getMaxAwaitTime()
-
setProjection
public FindOptions setProjection(JsonObject projection)
Sets a document describing the fields to return for all matching documents.- Parameters:
projection
- the project document, which may be null.- Returns:
- this
- MongoDB documentation
- Projection
-
getProjection
public JsonObject getProjection()
-
setSort
public FindOptions setSort(JsonObject sort)
Sets the sort criteria to apply to the query.- Parameters:
sort
- the sort criteria, which may be null.- Returns:
- this
- MongoDB documentation
- Sort
-
getSort
public JsonObject getSort()
-
setNoCursorTimeout
public FindOptions setNoCursorTimeout(java.lang.Boolean noCursorTimeout)
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.- Parameters:
noCursorTimeout
- true if cursor timeout is disabled- Returns:
- this
-
isNoCursorTimeout
public java.lang.Boolean isNoCursorTimeout()
-
setOplogReplay
@Deprecated public FindOptions setOplogReplay(java.lang.Boolean oplogReplay)
Deprecated.oplogReplay has been deprecated in MongoDB 4.4.Users should not set this under normal circumstances.- Parameters:
oplogReplay
- if oplog replay is enabled- Returns:
- this
-
isOplogReplay
@Deprecated public java.lang.Boolean isOplogReplay()
Deprecated.
-
setPartial
public FindOptions setPartial(java.lang.Boolean partial)
Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).- Parameters:
partial
- if partial results for sharded clusters is enabled- Returns:
- this
-
isPartial
public java.lang.Boolean isPartial()
-
setCursorType
public FindOptions setCursorType(CursorType cursorType)
Sets the cursor type.- Parameters:
cursorType
- the cursor type- Returns:
- this
-
getCursorType
public CursorType getCursorType()
-
setCollation
public FindOptions setCollation(Collation collation)
Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 1.3
- Since server release
- 3.4
-
getCollation
public Collation getCollation()
-
setComment
public FindOptions setComment(java.lang.String comment)
Sets the comment to the query. A null value means no comment is set.- Parameters:
comment
- the comment- Returns:
- this
- Since:
- 1.6
-
getComment
public java.lang.String getComment()
-
setHint
public FindOptions setHint(JsonObject hint)
Sets the hint for which index to use. A null value means no hint is set.- Parameters:
hint
- the hint- Returns:
- this
- Since:
- 1.6
-
getHint
public JsonObject getHint()
-
setHintString
public FindOptions setHintString(java.lang.String hint)
Sets the hint for which index to use. A null value means no hint is set.- Parameters:
hint
- the name of the index which should be used for the operation- Returns:
- this
- Since:
- 1.13
-
getHintString
public java.lang.String getHintString()
-
setMax
public FindOptions setMax(JsonObject max)
Sets the exclusive upper bound for a specific index. A null value means no max is set.- Parameters:
max
- the max- Returns:
- this
- Since:
- 1.6
-
getMax
public JsonObject getMax()
-
setMin
public FindOptions setMin(JsonObject min)
Sets the minimum inclusive lower bound for a specific index. A null value means no max is set.- Parameters:
min
- the min- Returns:
- this
- Since:
- 1.6
-
getMin
public JsonObject getMin()
-
setReturnKey
public FindOptions setReturnKey(java.lang.Boolean returnKey)
Sets the returnKey. If true the find operation will return only the index keys in the resulting documents.- Parameters:
returnKey
- the returnKey- Returns:
- this
- Since:
- 1.6
-
isReturnKey
public java.lang.Boolean isReturnKey()
-
setShowRecordId
public FindOptions setShowRecordId(java.lang.Boolean showRecordId)
Sets the showRecordId. Set to true to add a field$recordId
to the returned documents.- Parameters:
showRecordId
- the showRecordId- Returns:
- this
- Since:
- 1.6
-
isShowRecordId
public java.lang.Boolean isShowRecordId()
-
setBatchSize
public FindOptions setBatchSize(java.lang.Integer batchSize)
Sets the number of documents to return per batch.Overrides the
Subscription.request(long)
value for setting the batch size, allowing for fine grained control over the underlying cursor.- Parameters:
batchSize
- the batch size- Returns:
- this
- Since:
- 1.8
- MongoDB documentation
- Batch Size
-
getBatchSize
public java.lang.Integer getBatchSize()
-
setAllowDiskUse
public FindOptions setAllowDiskUse(java.lang.Boolean allowDiskUse)
Enables writing to temporary files on the server. When set to true, the server can write temporary data to disk while executing the find operation. This option is sent only if the caller explicitly sets it to true.- Parameters:
allowDiskUse
- the allowDiskUse- Returns:
- this
- Since:
- 4.1
- Since server release
- 4.4
-
isAllowDiskUse
public java.lang.Boolean isAllowDiskUse()
-
-