How to update nested array with aggregation pipeline

Hi Team,

I have scenario where I need to insert a document when there is no match found in the roles array. I tried but with the In condition it checks in any document but not in single document all the condition.
I can not use normal update with element match as I will end up calling db multiple times.

Sample mongo playground

I think i got it. let me know if there is any other idea.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.