Wrong answer from different query

hey, i cant get to know why this query isnt working ,
im setting the intersections in the first project
getting the size of it in the second (assigning 0 for non arrays)
and still getting the wrong answer please help
I managed to get to the right answer
im just trying to understand why is this wrong.

Next time, please format your code as in Formatting code and log snippets in posts so that we can cut-n-paste to try out and to reply.

The issue is that you compute …intersection in the same $project as the $map of writers. The mapped writers only exists in the next stage. The …intersection you compute in your first $project uses the original unmapped writers.

2 Likes

will do next time!
thank you!