Package dev.morphia
Class UpdateOptions
- java.lang.Object
-
- com.mongodb.client.model.UpdateOptions
-
- dev.morphia.UpdateOptions
-
- All Implemented Interfaces:
dev.morphia.internal.SessionConfigurable<UpdateOptions>
public class UpdateOptions extends com.mongodb.client.model.UpdateOptions implements dev.morphia.internal.SessionConfigurable<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 Deprecated Methods Modifier and Type Method Description <T> com.mongodb.client.MongoCollection<T>
apply(com.mongodb.client.MongoCollection<T> collection)
Updates the collection with the configured WriteConcernUpdateOptions
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)
com.mongodb.WriteConcern
getWriteConcern()
Deprecated, for removal: This API element is subject to removal in a future version.usewriteConcern()
insteadboolean
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
-
-
-
Method Detail
-
apply
public <T> com.mongodb.client.MongoCollection<T> apply(com.mongodb.client.MongoCollection<T> collection)
Updates the collection with the configured WriteConcern- Type Parameters:
T
- the collection type- Parameters:
collection
- the collection to update- Returns:
- the potentially updated collection
-
clientSession
public UpdateOptions clientSession(com.mongodb.client.ClientSession clientSession)
Description copied from interface:dev.morphia.internal.SessionConfigurable
Set the client session to use for the insert.- Specified by:
clientSession
in interfacedev.morphia.internal.SessionConfigurable<UpdateOptions>
- Parameters:
clientSession
- the client session- Returns:
- this
-
clientSession
public com.mongodb.client.ClientSession clientSession()
Description copied from interface:dev.morphia.internal.SessionConfigurable
The client session to use for the insertion.- Specified by:
clientSession
in interfacedev.morphia.internal.SessionConfigurable<UpdateOptions>
- Returns:
- the client session
-
getWriteConcern
@Deprecated(since="2.0", forRemoval=true) public com.mongodb.WriteConcern getWriteConcern()
Deprecated, for removal: This API element is subject to removal in a future version.usewriteConcern()
insteadThe write concern to use for the insertion. By default the write concern configured for the MongoCollection instance will be used.- Returns:
- the write concern, or null if the default will be used.
-
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(Boolean bypassDocumentValidation)
- Overrides:
bypassDocumentValidation
in classcom.mongodb.client.model.UpdateOptions
-
collation
public UpdateOptions collation(com.mongodb.client.model.Collation collation)
- Overrides:
collation
in classcom.mongodb.client.model.UpdateOptions
-
arrayFilters
public UpdateOptions arrayFilters(List<? extends org.bson.conversions.Bson> arrayFilters)
- Overrides:
arrayFilters
in classcom.mongodb.client.model.UpdateOptions
-
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.- Returns:
- the write concern, or null if the default will be used.
-
writeConcern
public UpdateOptions writeConcern(com.mongodb.WriteConcern writeConcern)
Sets the write concern- Parameters:
writeConcern
- the write concern- Returns:
- this
-
-