how do i receive an array comparing two other arrays using the aggregation framework?

You can simply use $setIntersection operator to keep only elements present in your array parameter.

    "$addFields": {
      "newArray": {
        $setIntersection: [

You can test it here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top