KOVA
Docs

Map

mapReduce returns one { key, value } document per match. It writes nothing.

mapReduce reads one collection and returns a cursor of pairs. The read stays on the process that received the command. On a replica set every voter already stores every document, so the command does not fan out. On a shard router it visits every shard and the batches are concatenated.

The command

db.runCommand({
  mapReduce: "emp",
  query: { deptno: 20 },
  map: { key: "$job", value: "$sal" }
})

query is a find filter. Leave it out and every document matches. map is a document with key and value. A string that starts with $ reads that field, including a dotted path. Any other value is a literal. A missing field becomes null.

The reply is firstBatch, the same cursor shape as find. Each document is { key, value }. For the employees in department 20, the pairs are the job and the salary of each person.

What is refused

A shell helper that always sends out will get that refusal. Send runCommand as written above.