Package dev.morphia
Class UpdateOptions
- java.lang.Object
-
- com.mongodb.client.model.UpdateOptions
-
- dev.morphia.UpdateOptions
-
- All Implemented Interfaces:
SessionConfigurable<UpdateOptions>
,WriteConfigurable<UpdateOptions>
public class UpdateOptions extends com.mongodb.client.model.UpdateOptions implements SessionConfigurable<UpdateOptions>, WriteConfigurable<UpdateOptions>
The options to apply when updating documents in the MongoCollection- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor Description UpdateOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpdateOptions
arrayFilter(Filter filter)
Adds a new array filterUpdateOptions
arrayFilters(List<? extends org.bson.conversions.Bson> arrayFilters)
UpdateOptions
bypassDocumentValidation(Boolean bypassDocumentValidation)
com.mongodb.client.ClientSession
clientSession()
The client session to use for the insertion.UpdateOptions
clientSession(com.mongodb.client.ClientSession clientSession)
Set the client session to use for the insert.UpdateOptions
collation(com.mongodb.client.model.Collation collation)
UpdateOptions
hint(org.bson.conversions.Bson hint)
UpdateOptions
hint(org.bson.Document hint)
UpdateOptions
hintString(String hint)
boolean
isMulti()
UpdateOptions
multi(boolean multi)
If true, sets this update to affect all matched documents.UpdateOptions
upsert(boolean upsert)
com.mongodb.WriteConcern
writeConcern()
The write concern to use for the insertion.UpdateOptions
writeConcern(com.mongodb.WriteConcern writeConcern)
Sets the write concern-
Methods inherited from class com.mongodb.client.model.UpdateOptions
getArrayFilters, getBypassDocumentValidation, getCollation, getHint, getHintString, isUpsert, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface dev.morphia.internal.WriteConfigurable
getWriteConcern, prepare
-
-
-
-
Method Detail
-
arrayFilter
public UpdateOptions arrayFilter(Filter filter)
Adds a new array filter- Parameters:
filter
- the new filter- Returns:
- this
- Since:
- 2.1
-
clientSession
public UpdateOptions clientSession(@Nullable com.mongodb.client.ClientSession clientSession)
Description copied from interface:SessionConfigurable
Set the client session to use for the insert.- Specified by:
clientSession
in interfaceSessionConfigurable<UpdateOptions>
- Parameters:
clientSession
- the client session- Returns:
- this
-
clientSession
@Nullable public com.mongodb.client.ClientSession clientSession()
Description copied from interface:SessionConfigurable
The client session to use for the insertion.- Specified by:
clientSession
in interfaceSessionConfigurable<UpdateOptions>
- Returns:
- the client session
-
hint
public UpdateOptions hint(org.bson.Document hint)
- Parameters:
hint
- the hint to apply- Returns:
- this
- Since:
- 2.2
- See Also:
hint(Bson)
-
isMulti
public boolean isMulti()
- Returns:
- true if the update should affect all entities
-
multi
public UpdateOptions multi(boolean multi)
If true, sets this update to affect all matched documents.- Parameters:
multi
- true for multiple updates- Returns:
- this
-
upsert
public UpdateOptions upsert(boolean upsert)
- Overrides:
upsert
in classcom.mongodb.client.model.UpdateOptions
-
bypassDocumentValidation
public UpdateOptions bypassDocumentValidation(@Nullable Boolean bypassDocumentValidation)
- Overrides:
bypassDocumentValidation
in classcom.mongodb.client.model.UpdateOptions
-
collation
public UpdateOptions collation(@Nullable com.mongodb.client.model.Collation collation)
- Overrides:
collation
in classcom.mongodb.client.model.UpdateOptions
-
arrayFilters
public UpdateOptions arrayFilters(@Nullable List<? extends org.bson.conversions.Bson> arrayFilters)
- Overrides:
arrayFilters
in classcom.mongodb.client.model.UpdateOptions
-
hint
public UpdateOptions hint(@Nullable org.bson.conversions.Bson hint)
- Overrides:
hint
in classcom.mongodb.client.model.UpdateOptions
- Returns:
- this
- Since:
- 2.2
-
hintString
public UpdateOptions hintString(@Nullable String hint)
- Overrides:
hintString
in classcom.mongodb.client.model.UpdateOptions
- Returns:
- this
- Since:
- 2.2
-
writeConcern
public UpdateOptions writeConcern(@Nullable com.mongodb.WriteConcern writeConcern)
Sets the write concern- Specified by:
writeConcern
in interfaceWriteConfigurable<UpdateOptions>
- Parameters:
writeConcern
- the write concern- Returns:
- this
-
writeConcern
public com.mongodb.WriteConcern writeConcern()
The write concern to use for the insertion. By default the write concern configured for the MongoCollection instance will be used.- Specified by:
writeConcern
in interfaceWriteConfigurable<UpdateOptions>
- Returns:
- the write concern, or null if the default will be used.
-
-