Ch3 Lab - project min/max returning multiple docs

Without putting pipeline query here, I basically have a match step to match all movies that have won at least one oscar, then I use a project stage to get the min and max … however, it is returning multiple documents … and I can’t figure out why? :frowning:

I expect the project min and/or max to return only one document containing the max and min imdb rating.

Ah, ok … I think I get it. My $project was just giving the min/max of each document which doesn’t really make sense, since there’s only one rating per movie doc. So, I had to do a group on _id: null like in an example in the first lecture 3 video, and do a min/max on the group … I think that is working, it does return only one answer like expected.

1 Like


Exactly correct. $min and $max return the appropriate values for each document. Glad you got it. Good luck.