Class UpdateBuilder
java.lang.Object
dev.getelements.elements.dao.mongo.UpdateBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.mongodb.client.result.UpdateResultexecute(dev.morphia.query.Query<?> query, dev.morphia.UpdateOptions options) Equivalent to invokingupdate(Query)(Query)}.Update.execute(UpdateOptions)<ModelT> ModelTexecute(dev.morphia.query.Query<ModelT> query, dev.morphia.ModifyOptions options) Equivalent to invokingmodify(Query).<ModelT> dev.morphia.query.Modify<ModelT> modify(dev.morphia.query.Query<ModelT> query) Builds theModifyfrom the suppliedQuery.<ModelT> dev.morphia.query.Update<ModelT> update(dev.morphia.query.Query<ModelT> query) Builds theUpdatefrom the suppliedQuery.with(dev.morphia.query.updates.UpdateOperator op) Appends anUpdateOperator.with(dev.morphia.query.updates.UpdateOperator first, dev.morphia.query.updates.UpdateOperator... subsequent) Appends anUpdateOperator.<T> Twith(Function<UpdateBuilder, T> op) Accepts anFunctionwhich consumes thisUpdateBuilderand returns the value returned by the function.
-
Constructor Details
-
UpdateBuilder
public UpdateBuilder()
-
-
Method Details
-
with
Appends anUpdateOperator.- Parameters:
op- the operator- Returns:
- this instance
-
with
public UpdateBuilder with(dev.morphia.query.updates.UpdateOperator first, dev.morphia.query.updates.UpdateOperator... subsequent) Appends anUpdateOperator.- Parameters:
first- the first operator to applysubsequent- the subsequent operators to apply- Returns:
- this instance
-
with
Accepts anFunctionwhich consumes thisUpdateBuilderand returns the value returned by the function.- Type Parameters:
T- the return type.- Parameters:
op- the operation to apply to thisUpdateBuilder- Returns:
- the value returned from the operation
-
modify
public <ModelT> dev.morphia.query.Modify<ModelT> modify(dev.morphia.query.Query<ModelT> query) Builds theModifyfrom the suppliedQuery.- Type Parameters:
ModelT- the model type to update- Parameters:
query- theQuery- Returns:
- an instance of
Modifywith the updates supplied by this builder - Throws:
IllegalStateException- if no updates were applied.
-
update
public <ModelT> dev.morphia.query.Update<ModelT> update(dev.morphia.query.Query<ModelT> query) Builds theUpdatefrom the suppliedQuery.- Type Parameters:
ModelT- the model type to update- Parameters:
query- theQuery- Returns:
- an instance of
Updatewith the updates supplied by this builder - Throws:
IllegalStateException- if no updates were applied.
-
execute
public com.mongodb.client.result.UpdateResult execute(dev.morphia.query.Query<?> query, dev.morphia.UpdateOptions options) Equivalent to invokingupdate(Query)(Query)}.Update.execute(UpdateOptions)- Parameters:
query- theQueryagainst which to apply the updates- Returns:
- the
UpdateResult
-
execute
public <ModelT> ModelT execute(dev.morphia.query.Query<ModelT> query, dev.morphia.ModifyOptions options) Equivalent to invokingmodify(Query).Modify.execute(ModifyOptions)- Parameters:
query- theQueryagainst which to apply the updates- Returns:
- the model
-