Package dev.morphia
Class FindAndModifyOptions
- java.lang.Object
-
- dev.morphia.FindAndModifyOptions
-
public final class FindAndModifyOptions extends java.lang.Object
The options for find and modify operations.- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor Description FindAndModifyOptions()
Creates a new options instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FindAndModifyOptions
bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets the bypassDocumentValidationFindAndModifyOptions
collation(com.mongodb.client.model.Collation collation)
Sets the collationjava.lang.Boolean
getBypassDocumentValidation()
Returns the bypassDocumentValidationcom.mongodb.client.model.Collation
getCollation()
Returns the collation optionslong
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.com.mongodb.WriteConcern
getWriteConcern()
Returns the writeConcernboolean
isRemove()
Returns the removeboolean
isReturnNew()
Returns the returnNewboolean
isUpsert()
Returns the upsertFindAndModifyOptions
maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.FindAndModifyOptions
remove(boolean remove)
Deprecated.This will be removed in 2.0.FindAndModifyOptions
returnNew(boolean returnNew)
Sets the returnNewFindAndModifyOptions
upsert(boolean upsert)
Indicates that an upsert should be performedFindAndModifyOptions
writeConcern(com.mongodb.WriteConcern writeConcern)
Sets the writeConcern
-
-
-
Method Detail
-
isRemove
public boolean isRemove()
Returns the remove- Returns:
- the remove
-
remove
@Deprecated public FindAndModifyOptions remove(boolean remove)
Deprecated.This will be removed in 2.0. useDatastore.findAndDelete(Query)
to remove items.Indicates whether to remove the elements matching the query or not- Parameters:
remove
- true if the matching elements should be deleted- Returns:
- this
-
isUpsert
public boolean isUpsert()
Returns the upsert- Returns:
- the upsert
-
upsert
public FindAndModifyOptions upsert(boolean upsert)
Indicates that an upsert should be performed- Parameters:
upsert
- the upsert- Returns:
- this
- MongoDB documentation
- reference/method/db.collection.update/#upsert-behavior upsert
-
isReturnNew
public boolean isReturnNew()
Returns the returnNew- Returns:
- the returnNew
-
returnNew
public FindAndModifyOptions returnNew(boolean returnNew)
Sets the returnNew- Parameters:
returnNew
- the returnNew- Returns:
- this
-
getBypassDocumentValidation
public java.lang.Boolean getBypassDocumentValidation()
Returns the bypassDocumentValidation- Returns:
- the bypassDocumentValidation
-
bypassDocumentValidation
public FindAndModifyOptions bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets the bypassDocumentValidation- Parameters:
bypassDocumentValidation
- the bypassDocumentValidation- Returns:
- this
-
getMaxTime
public long getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time.- Parameters:
timeUnit
- the time unit to return the result in- Returns:
- the maximum execution time in the given time unit
- MongoDB documentation
- reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time
-
maxTime
public FindAndModifyOptions maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.- Parameters:
maxTime
- the max timetimeUnit
- the time unit, which may not be null- Returns:
- this
- MongoDB documentation
- reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time
-
getWriteConcern
public com.mongodb.WriteConcern getWriteConcern()
Returns the writeConcern- Returns:
- the writeConcern
- Since server release
- 3.2
-
writeConcern
public FindAndModifyOptions writeConcern(com.mongodb.WriteConcern writeConcern)
Sets the writeConcern- Parameters:
writeConcern
- the writeConcern- Returns:
- this
- Since server release
- 3.2
-
getCollation
public com.mongodb.client.model.Collation getCollation()
Returns the collation options- Returns:
- the collation options
- Since server release
- 3.4
-
collation
public FindAndModifyOptions collation(com.mongodb.client.model.Collation collation)
Sets the collation- Parameters:
collation
- the collation- Returns:
- this
- Since server release
- 3.4
-
-