Explain the output from the query

Hi Team,


From can you please explain expression
$gt: [
{ $size: { $setIntersection: ["$cast", “$directors”, “$writers”] } },
0
]

  1. What is the result of $setIntersection: ["$cast", “$directors”, “$writers”] }
  2. In $gt “$setIntersection” value is matched with 0?

Thanks
Rahul Chauhan

Everything you need to know is actually in the documentation.

$setIntersection documentation

And here’s a diagrammatic example:
image

$gt documentation

Let us know if you still need further clarity.

2 Likes

I have remove the part you have asked to delete.

$gt part I was not clear earlier that in aggregation it compares 1st with 2nd element. It is clear now.

Thank you!

Good job! :slightly_smiling_face: :+1: