At the start of this chapter is the following statement about 18 seconds in.
_Accumulator expressions in $project operate over an array in the current document, they do not carry over values over all documents.
They do not carry values over to each document encountered_
I understand the commands, but I don’t understand why this statement has been made.
Is it saying that any accumulator expressions used in $project, cannot carry their values over multiple documents, so I cannot average the movie critic value over every document. I can average values in that document only.
If that is the case, we would perform this average function via a $group?
OR is it saying that accumulator expressions only work on arrays in $project.
PS - If this is the case, then it is always good that the course, gives the other side of the example, it is easier to compare and contrast examples.
PPS - There do seem to be a lot of expressions, that work one way in $project, subtly different in $group , little gotchas you need to be aware of.