Mongo Streams supports mongodbs mapreduce functionality. Similarly with Aggregation Pipeline syntax mapReduce is based
on initial query. It also honors the
sort` syntax from query. Following are available syntax for mapReduce operation:
query() mapReduce (mapJavaScript reduce reduceJavaScript)
query() mapReduce (mapJavaScript reduce reduceJavaScript finalize finalizeJavaScript)
query() sort ("key" Ascending) mapReduce (mapJavaScript reduce reduceJavaScript )
query() mapReduce (mapJavaScript reduce reduceJavaScript scope scopeJavascript)
query() mapReduce (mapJavaScript reduce reduceJavaScript jsModeInMemory)
query() mapReduce (mapJavaScript reduce reduceJavaScript verbose)
query() mapReduce (mapJavaScript reduce reduceJavaScript limit (100))
Each mapReduce command may eventually specify if results will be stored persistently into database, where these results will be stored and
how the results will be stored. By default results override any results found in target collection. This is controlled with persists syntax:
query() mapReduce (mapJavaScript reduce reduceJavaScript persist ("results"))
query() mapReduce (mapJavaScript reduce reduceJavaScript persist ("resultdb.results"))
query() mapReduce (mapJavaScript reduce reduceJavaScript persist (dbCollection))
query() mapReduce (mapJavaScript reduce reduceJavaScript persist (dbCollection) mergeCurrent)
query() mapReduce (mapJavaScript reduce reduceJavaScript persist (dbCollection) reduceCurrent)
query() mapReduce (mapJavaScript reduce reduceJavaScript persist (dbCollection) asShard)
query() mapReduce (mapJavaScript reduce reduceJavaScript persist (dbCollection) nonAtomic)
Total for specification MapReduceSpec | |
---|---|
Finished in | 2 seconds, 320 ms |
Results | 4 examples, 0 failure, 0 error |