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 UpdateOptions
arrayFilter(Filter filter)
Adds a new array filterUpdateOptions
arrayFilters(List<? extends Bson> arrayFilters)
UpdateOptions
bypassDocumentValidation(Boolean bypassDocumentValidation)
UpdateOptions
collation(Collation collation)
String
collection()
Returns the alternate collection to use for the operation.UpdateOptions
collection(String collection)
Sets the alternate collection to use for the operation.UpdateOptions
comment(String comment)
UpdateOptions
comment(BsonValue comment)
UpdateOptions
hint(Bson hint)
UpdateOptions
hint(Document hint)
UpdateOptions
hintString(String hint)
boolean
isMulti()
Deprecated, for removal: This API element is subject to removal in a future version.UpdateOptions
let(Bson variables)
boolean
multi()
UpdateOptions
multi(boolean multi)
If true, sets this update to affect all matched documents.UpdateOptions
upsert(boolean upsert)
WriteConcern
writeConcern()
The write concern to use for the insertion.UpdateOptions
writeConcern(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.CollectionConfigurable
Sets the alternate collection to use for the operation.- Specified by:
collection
in 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.CollectionConfigurable
Returns the alternate collection to use for the operation. Might return null.- Specified by:
collection
in interfacedev.morphia.internal.CollectionConfigurable<UpdateOptions>
- Returns:
- the collection name or null
-
comment
public UpdateOptions comment(String comment)
- Overrides:
comment
in classUpdateOptions
- Parameters:
comment
- the comment- Returns:
- this
- Since:
- 2.3
- See Also:
InsertOneOptions.comment(String)
-
comment
public UpdateOptions comment(BsonValue comment)
- Overrides:
comment
in classUpdateOptions
- Parameters:
comment
- the comment- Returns:
- this
- Since:
- 2.3
- See Also:
InsertOneOptions.comment(BsonValue)
-
let
public UpdateOptions let(Bson variables)
- Overrides:
let
in 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:
upsert
in classUpdateOptions
-
bypassDocumentValidation
public UpdateOptions bypassDocumentValidation(@Nullable Boolean bypassDocumentValidation)
- Overrides:
bypassDocumentValidation
in classUpdateOptions
-
collation
public UpdateOptions collation(@Nullable Collation collation)
- Overrides:
collation
in classUpdateOptions
-
arrayFilters
public UpdateOptions arrayFilters(@Nullable List<? extends Bson> arrayFilters)
- Overrides:
arrayFilters
in 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:
hint
in classUpdateOptions
- Returns:
- this
- Since:
- 2.2
-
hintString
public UpdateOptions hintString(@Nullable String hint)
- Overrides:
hintString
in classUpdateOptions
- Returns:
- this
- Since:
- 2.2
-
writeConcern
public UpdateOptions writeConcern(@Nullable WriteConcern writeConcern)
Sets the write concern- Specified by:
writeConcern
in 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:
writeConcern
in interfacedev.morphia.internal.WriteConfigurable<UpdateOptions>
- Returns:
- the write concern, or null if the default will be used.
-
-