Flexibility of map-reduce in mongoDB - mongodb

The MongoDB documentation says about map-reduce:
For most aggregation operations, the Aggregation Pipeline provides better performance and more coherent interface. However, map-reduce operations provide some flexibility that is not presently available in the aggregation pipeline.
Does it mean that there are some aggregation operations that cannot be performed in the usual MongoDB aggregation framework but are possible using map-reduce?
In particular I'm looking for an example of map-reduce that cannot be implemented in the MongoDB aggregation framework
Thanks!

An example of "flexibility". Basically, if you have any logic, that does not fit into standard aggregation operators, map-reduce is the only option to do it serverside.

Related

Which one is good mongodb aggregate or mongodb functions

Which one is good mongodb aggregate or mongodb functions
what i mean to say : mongodb aggregation or mongodb functional which one is preforable and which one gives good performance.
Mongodb functions
Defines a custom aggregation function or expression in JavaScript.
Whereas aggregation is a prebuilt supported operations.
Executing JavaScript inside an aggregation expression may decrease performance. Only use the $function operator if the provided pipeline operators cannot fulfill your application's needs.
If you have a logic which needs to be customised not supported out of the box, go for functions.
Reference

How is the aggregation achieved with MongoDB

How is the aggregation achieved with MongoDB ?
using mongoDB for some near real time aggregation and how it scale if the aggregation pipeline results are large ?
Is there any performance tuning methods during aggregation
Is there any performance tuning methods during aggregation
There are many. You should refer the documentation about query optimization
using mongoDB for some near real time aggregation and how it scale if the aggregation pipeline results are large ?
Refer this
Limit the number of documents - to handle network demand
use projection to return only the necessary fields.

In mongodb Which is better to use- MapReduce or Aggregation pipeline?

Some blogs says that mapreduce is slower than aggregation. So which one is ideal to use?
If you go through the official document you can clearly see it written:
For most aggregation operations, the Aggregation Pipeline provides better performance and more coherent interface. However, map-reduce operations provide some flexibility that is not presently available in the aggregation pipeline.

Why do MongoDB views not support MapReduce?

I am developing a database with MongoDB and would like to treat views as read-only collections. Particularly, I would really like to run map-reduce functions on a view. So my questions include:
Why do views not support map-reduce?
Are there plans to give map-reduce functionality to views in the future?
Is there a workaround that would allow me to run map-reduce on query results?
Views in MongoDB are not materialized so querying a view involves running the aggregation pipeline that you specified when you defined the view. This means that you can do further aggregations on the view via aggregation pipeline, but you cannot use map/reduce which cannot run aggregation stages as part of its execution.
Most things that you can do with map/reduce in MongoDB can be done with aggregation pipeline (though certainly not all). I would recommend seeing how far you can get using purely aggregation rather than map-reduce.

Examples which can be done by map reduce only and not aggregation framework in mongodb?

I wanted to know about some examples or scenarios related to Mongo DB which can be done by map-reduce but not aggregation framework ?
Map-reduce is considered to be very powerful tool/mechanism of aggregating data. Then can some of you please share few scenarios where it is not possible for map-reduce to do it ?
Thanks & Best Regards.
In MongoDB currently aggregation framework is limited to 16MB of returned results.
MapReduce can write its output to a collection and has no size limitations.
MapReduce can group entire documents, aggregation framework works on field level. MapReduce can map keys to values and values to keys which can't be done any other way. MapReduce can also call/use various JavaScript built-in functions where aggregation is limited to functions and expressions which are built-in to its framework.