Class UpdateBuilder
java.lang.Object
dev.getelements.elements.dao.mongo.UpdateBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.mongodb.client.result.UpdateResult
execute
(dev.morphia.query.Query<?> query, dev.morphia.UpdateOptions options) Equivalent to invokingupdate(Query)
(Query)}.Update.execute(UpdateOptions)
<ModelT> ModelT
execute
(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 theModify
from the suppliedQuery
.<ModelT> dev.morphia.query.Update
<ModelT> update
(dev.morphia.query.Query<ModelT> query) Builds theUpdate
from 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> T
with
(Function<UpdateBuilder, T> op) Accepts anFunction
which consumes thisUpdateBuilder
and 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 anFunction
which consumes thisUpdateBuilder
and 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 theModify
from the suppliedQuery
.- Type Parameters:
ModelT
- the model type to update- Parameters:
query
- theQuery
- Returns:
- an instance of
Modify
with 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 theUpdate
from the suppliedQuery
.- Type Parameters:
ModelT
- the model type to update- Parameters:
query
- theQuery
- Returns:
- an instance of
Update
with 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
- theQuery
against 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
- theQuery
against which to apply the updates- Returns:
- the model
-