Why does MongoDB still support MapReduce, but actively discourage people from using it?
The answer is no, the aggregation framework does not replace &quot;every conceivable&quot; MapReduce configuration. Without becoming a general purpose MapReduce framework with fully customizable functions, it can't. That's what you get with the existing MapReduce functionality - any functions you want (as long as they can be written in Javascripts of course).
I haven't used it in a long time (years), but it is not just because of the use of the javascript engine that the MapReduce funcionality is slower, it still does things like taking a global write lock (docs) when writing output which will block all other operations on a mongod - ouch. Even several version prior to this, when the Aggregation Framework was nowhere near as featureful as it is now the advice was: if you can use the aggregation framework, do so, only use MapReduce if you have no other choice.