@Lauren_Schaefer I just watched your MongoDB & Node.js: Aggregation & Data Analysis (Part 2 of 4) i have a collection called reviews in which i have 2 foreign keys (product and user) , i am using aggregate to query the reviews collection , where i want to match reviews with rating >= 3 and then $lookup to populate product and user. It giving me result but in Array , what i want that in result it should show me only name of the product and name of the user instead of complete document. What should be the stages of pipeline for such aggregation ? Thanks in Advance
Hi @Noor_Arman - Welcome to the community!
I think $project is what you’re looking for. $project lets you define the fields that should be included in the next stage. Those fields can either be existing fields or newly calculated fields.
If $project isn’t what you’re looking for, can you include a sample document from each collection as well as the final output you’re hoping for?