How to use temporary variables in aggregations

Hi @turivishal ,

in fact the reason or use case is described in this post: Aggregations: Use $cond without an else clause

I want to use a condition ($cond) without an else clause to update a field in case the if-condition resolves to true. If it resolves to false the field should stay untouched. Since I found no other/better way so far I store the origin value into a temp variable, execute the else clause i set the field to the stored origin value.

However, this is rather cumbersome …

And thanks for the hint regarding $$REMOVE.

1 Like