About Pipeline Optimization Pt. 1

It says, around 7:10, that don’t project unnecessarily, and also remember that addFields is available. I know addFields behaves similarly to project in that it only adds new fields to documents, where those fields can be new values (i.e. an &avg).

But I want to understand the reason why addFields adds to optimization performance inside an aggregation pipeline. Is it because addfields don’t add iterations as project does?

1 Like