public class FindOneAndUpdateOptions extends Object
Constructor | Description |
---|---|
FindOneAndUpdateOptions() |
Modifier and Type | Method | Description |
---|---|---|
FindOneAndUpdateOptions |
arrayFilters(List<? extends Bson> arrayFilters) |
Sets the array filters option
|
FindOneAndUpdateOptions |
bypassDocumentValidation(Boolean bypassDocumentValidation) |
Sets the bypass document level validation flag.
|
FindOneAndUpdateOptions |
collation(Collation collation) |
Sets the collation options
|
List<? extends Bson> |
getArrayFilters() |
Returns the array filters option
|
Boolean |
getBypassDocumentValidation() |
Gets the the bypass document level validation flag
|
Collation |
getCollation() |
Returns the collation options
|
long |
getMaxTime(TimeUnit timeUnit) |
Gets the maximum execution time for the find one and update operation.
|
Bson |
getProjection() |
Gets a document describing the fields to return for all matching documents.
|
ReturnDocument |
getReturnDocument() |
Gets the
ReturnDocument value indicating whether to return the document before it was updated / inserted or after |
Bson |
getSort() |
Gets the sort criteria to apply to the query.
|
boolean |
isUpsert() |
Returns true if a new document should be inserted if there are no matches to the query filter.
|
FindOneAndUpdateOptions |
maxTime(long maxTime,
TimeUnit timeUnit) |
Sets the maximum execution time on the server for this operation.
|
FindOneAndUpdateOptions |
projection(Bson projection) |
Sets a document describing the fields to return for all matching documents.
|
FindOneAndUpdateOptions |
returnDocument(ReturnDocument returnDocument) |
Set whether to return the document before it was updated / inserted or after
|
FindOneAndUpdateOptions |
sort(Bson sort) |
Sets the sort criteria to apply to the query.
|
String |
toString() |
|
FindOneAndUpdateOptions |
upsert(boolean upsert) |
Set to true if a new document should be inserted if there are no matches to the query filter.
|
@Nullable public Bson getProjection()
public FindOneAndUpdateOptions projection(@Nullable Bson projection)
projection
- the project document, which may be null.@Nullable public Bson getSort()
public FindOneAndUpdateOptions sort(@Nullable Bson sort)
sort
- the sort criteria, which may be null.public boolean isUpsert()
public FindOneAndUpdateOptions upsert(boolean upsert)
upsert
- true if a new document should be inserted if there are no matches to the query filterpublic ReturnDocument getReturnDocument()
ReturnDocument
value indicating whether to return the document before it was updated / inserted or afterReturnDocument.BEFORE
if returning the document before it was updated or inserted otherwise
returns ReturnDocument.AFTER
public FindOneAndUpdateOptions returnDocument(ReturnDocument returnDocument)
returnDocument
- set whether to return the document before it was updated / inserted or afterpublic FindOneAndUpdateOptions maxTime(long maxTime, TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic long getMaxTime(TimeUnit timeUnit)
timeUnit
- the time unit for the result@Nullable public Boolean getBypassDocumentValidation()
public FindOneAndUpdateOptions bypassDocumentValidation(@Nullable Boolean bypassDocumentValidation)
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.@Nullable public Collation getCollation()
public FindOneAndUpdateOptions collation(@Nullable Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic FindOneAndUpdateOptions arrayFilters(@Nullable List<? extends Bson> arrayFilters)
arrayFilters
- the array filters, which may be null@Nullable public List<? extends Bson> getArrayFilters()