Why does MongoDB still support MapReduce, but actively discourage people from using it?


Looking at the MongoDB documentation I see that users are discouraged from using MapReduce in favour of the Aggregation pipeline.

For example, on this page in the documentation.

But the same notice is ambiguous in terms of whether the Aggregation Framework completely replaces MapReduce or not:

Various map-reduce operations can be rewritten using aggregation pipeline operators, such as $group, $merge, etc. For map-reduce operations that require custom functionality, MongoDB provides the $accumulator and $function aggregation operators starting in version 4.4.

Does this mean that “every conceivable” MapReduce configuration can be replicated via the Aggregation Framework or not?

I understand that the MapReduce execution context might be slower than the Aggregation pipeline since the former requires a JavaScript engine which is/was/still is? slower than the Aggregation pipeline implementation.

Unlike other features, MapReduce has NOT been labeled as deprecated so far as I know. So, my question is:

Is MapReduce completely replaced (for every single possible use-case) by the Aggregation Framework? Or are there use-cases where MapReduce still provides for greater flexibility?