hello there, lets say i have a collection consisting of products for an ecommerce store. what i want to do is change title for products that are cheaper than 50. that is simple with aggregations with something like this :
but, with this approach, the output will only contain products that are cheaper than 50$. and if i want to run some other aggregation on the same collection i have to run another aggregation from start.
what i want to do is pass an argument to $set function and tell it to only work on documents that are cheaper than 50$.
is there a way i can achieve this with aggregations ?
@Pavel_Duchovny sir you cant possibly imagine how much this helped me !
i just cant believe i missed this in documentation this will make my job a lot easier.
If you look at the documentation the if condition must receive a Boolean expression. Only operators or the Boolean themselves return this. A document expression does not.