The answer to your specific question is no.
The map function is applied to each document in the database, and the reduction function, if defined, is applied to each reduction result. Think about preliminary calculations.
The query parameters that you specify in the URL apply to the B + tree, which your MapReduce functions build. For example, if you say ?limit=5
, then five left leaves in the tree will be used as the results. Or, if you say ?limit=5&descending=true
, the five right leaves in the tree are used as results.
However, what you are trying to accomplish by doing ?limit=5
in the Map function can be done in a different way. For example, your application may include something in documents that caused them to receive conditional inclusion in the results. Or make sure that only five documents are marked in the index, although this would be cumbersome and expensive depending on the size of your database.
Greetings.
source share