-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Closed as not planned
Copy link
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.comstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
Hi 👋,
I'm relying on AggregationUpdate with ConditionalOperators and switchCases in order to update multiple documents in one shot.
This work well for set, unset, conditional set..
cf. doc or my example below:
AggregationUpdate update = AggregationUpdate.update()
.set("updateTs").toValue(updateTs)
.set("result").toValue(
ConditionalOperators.switchCases(
CaseOperator.when(In.arrayOf("$myArray.state").containsValue("VALA")).then("VALA"),
CaseOperator.when(In.arrayOf("$myArray.state").containsValue("VALB")).then("VALB")
).defaultTo("UNKNOWN")
)
.unset("updateRequested");
UpdateResult result = mongoTemplate.updateMulti(query, update, ResultDocument.class);Now, I want to add a push operation to my existing update,
ideally something like that:
// .push("myArray", newValueToPush);// no
// .set("myArray").toValueOf(Aggregation.group("myArray").push(newValueToPush));// unexpected usagebut I'm unable to find a way to do that
(push is available in common update, or else in newAggregation as for example group("myArray").push(..)).
Could you explain me if this is possible and then how to do that ?
or else mark this as improvement (if allowed by mongo for this kind of aggregation) ?
In advance thanks
Metadata
Metadata
Assignees
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.comstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid