Starting in MongoDB 5.0, map-reduce is deprecated: Instead of map-reduce, you should use an aggregation pipeline. Aggregation pipelines provide better performance and usability than map-reduce. You can rewrite map-reduce operations using aggregation pipeline stages, such as $group, $merge, and others. For map-reduce operations that require custom functionality, you can use the $accumulator and $fu