Default exclude in aggregations?

Is there a way to automatically exclude certain (sensitive) fields from lookup calls in aggregations? I don’t want to always have to remember to remove sensitive data. Mongoose has select: false but I noticed that this doesn’t work with lookup and I have to remove fields manually.

I guess you could create a view with lookup in the definition that has a projection in the subpipeline, and query that view instead of the original collections.

1 Like

Thank you, I will look into it!