Package dev.morphia
Class UpdateOptions
- java.lang.Object
-
- com.mongodb.client.model.UpdateOptions
-
- dev.morphia.UpdateOptions
-
- All Implemented Interfaces:
dev.morphia.internal.CollectionConfigurable<UpdateOptions>,dev.morphia.internal.CollectionConfiguration,dev.morphia.internal.WriteConfigurable<UpdateOptions>
public class UpdateOptions extends UpdateOptions implements dev.morphia.internal.WriteConfigurable<UpdateOptions>, dev.morphia.internal.CollectionConfigurable<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 UpdateOptionsarrayFilter(Filter filter)Adds a new array filterUpdateOptionsarrayFilters(List<? extends Bson> arrayFilters)UpdateOptionsbypassDocumentValidation(Boolean bypassDocumentValidation)UpdateOptionscollation(Collation collation)Stringcollection()Returns the alternate collection to use for the operation.UpdateOptionscollection(String collection)Sets the alternate collection to use for the operation.UpdateOptionscomment(String comment)UpdateOptionscomment(BsonValue comment)UpdateOptionshint(Bson hint)UpdateOptionshint(Document hint)UpdateOptionshintString(String hint)booleanisMulti()Deprecated, for removal: This API element is subject to removal in a future version.UpdateOptionslet(Bson variables)booleanmulti()UpdateOptionsmulti(boolean multi)If true, sets this update to affect all matched documents.UpdateOptionsupsert(boolean upsert)WriteConcernwriteConcern()The write concern to use for the insertion.UpdateOptionswriteConcern(WriteConcern writeConcern)Sets the write concern-
Methods inherited from class com.mongodb.client.model.UpdateOptions
getArrayFilters, getBypassDocumentValidation, getCollation, getComment, getHint, getHintString, getLet, isUpsert, toString
-
-
-
-
Method Detail
-
arrayFilter
public UpdateOptions arrayFilter(Filter filter)
Adds a new array filter- Parameters:
filter- the new filter- Returns:
- this
- Since:
- 2.1
-
collection
public UpdateOptions collection(String collection)
Description copied from interface:dev.morphia.internal.CollectionConfigurableSets the alternate collection to use for the operation.- Specified by:
collectionin interfacedev.morphia.internal.CollectionConfigurable<UpdateOptions>- Parameters:
collection- the name of the collection to use- Returns:
- this
-
collection
public String collection()
Description copied from interface:dev.morphia.internal.CollectionConfigurableReturns the alternate collection to use for the operation. Might return null.- Specified by:
collectionin interfacedev.morphia.internal.CollectionConfigurable<UpdateOptions>- Returns:
- the collection name or null
-
comment
public UpdateOptions comment(String comment)
- Overrides:
commentin classUpdateOptions- Parameters:
comment- the comment- Returns:
- this
- Since:
- 2.3
- See Also:
InsertOneOptions.comment(String)
-
comment
public UpdateOptions comment(BsonValue comment)
- Overrides:
commentin classUpdateOptions- Parameters:
comment- the comment- Returns:
- this
- Since:
- 2.3
- See Also:
InsertOneOptions.comment(BsonValue)
-
let
public UpdateOptions let(Bson variables)
- Overrides:
letin classUpdateOptions- Returns:
- this
- Since:
- 2.3
- See Also:
UpdateOptions.let(Bson)
-
hint
public UpdateOptions hint(Document hint)
- Parameters:
hint- the hint to apply- Returns:
- this
- Since:
- 2.2
- See Also:
hint(Bson),UpdateOptions.hint(Bson)
-
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:
upsertin classUpdateOptions
-
bypassDocumentValidation
public UpdateOptions bypassDocumentValidation(@Nullable Boolean bypassDocumentValidation)
- Overrides:
bypassDocumentValidationin classUpdateOptions
-
collation
public UpdateOptions collation(@Nullable Collation collation)
- Overrides:
collationin classUpdateOptions
-
arrayFilters
public UpdateOptions arrayFilters(@Nullable List<? extends Bson> arrayFilters)
- Overrides:
arrayFiltersin classUpdateOptions
-
isMulti
@Deprecated(forRemoval=true, since="2.3") public boolean isMulti()
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- true if the update should affect all entities
-
multi
@MorphiaInternal public boolean multi()
- Returns:
- true if the update should affect all entities
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
hint
public UpdateOptions hint(@Nullable Bson hint)
- Overrides:
hintin classUpdateOptions- Returns:
- this
- Since:
- 2.2
-
hintString
public UpdateOptions hintString(@Nullable String hint)
- Overrides:
hintStringin classUpdateOptions- Returns:
- this
- Since:
- 2.2
-
writeConcern
public UpdateOptions writeConcern(@Nullable WriteConcern writeConcern)
Sets the write concern- Specified by:
writeConcernin interfacedev.morphia.internal.WriteConfigurable<UpdateOptions>- Parameters:
writeConcern- the write concern- Returns:
- this
-
writeConcern
public 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:
writeConcernin interfacedev.morphia.internal.WriteConfigurable<UpdateOptions>- Returns:
- the write concern, or null if the default will be used.
-
-