Package dev.morphia
Class FindAndModifyOptions
- java.lang.Object
-
- dev.morphia.FindAndModifyOptions
-
public final class FindAndModifyOptions extends java.lang.ObjectThe 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 FindAndModifyOptionsbypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)Sets the bypassDocumentValidationFindAndModifyOptionscollation(com.mongodb.client.model.Collation collation)Sets the collationjava.lang.BooleangetBypassDocumentValidation()Returns the bypassDocumentValidationcom.mongodb.client.model.CollationgetCollation()Returns the collation optionslonggetMaxTime(java.util.concurrent.TimeUnit timeUnit)Gets the maximum execution time on the server for this operation.com.mongodb.WriteConcerngetWriteConcern()Returns the writeConcernbooleanisRemove()Returns the removebooleanisReturnNew()Returns the returnNewbooleanisUpsert()Returns the upsertFindAndModifyOptionsmaxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)Sets the maximum execution time on the server for this operation.FindAndModifyOptionsremove(boolean remove)Deprecated.This will be removed in 2.0.FindAndModifyOptionsreturnNew(boolean returnNew)Sets the returnNewFindAndModifyOptionsupsert(boolean upsert)Indicates that an upsert should be performedFindAndModifyOptionswriteConcern(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
-
-