Detailed description of the MongoDB mapreduce parameter

Source: Internet
Author: User
Tags mongodb


https://docs.mongodb.org/manual/reference/method/db.collection.mapReduce/#mapreduce-OUT-MTD

The following is a description of the MapReduce output

Output to a Collection with an Action

This option was only available when passing a collection the already exists to out. It is not available on secondary members of replica sets.

Out: {<action>: <collectionName>
        [, DB: <dbname>]
        [, sharded: <boolean>]
        [, Nonatomic: <boolean>]}

When you output to a collection with an action, the out has the following parameters:

<action>: Specify one of the following actions:

Replace

Replace the contents of the <collectionName> if the collection with the<collectionname> exists.

Merge

Merge The new result with the existing result if the output collection already exists. If the existing document has the same key as the new result, overwrite that existing document.

Reduce

Merge The new result with the existing result if the output collection already exists. If the existing document has the same key as the new result, apply the reduce function to both the new and the existing doc Uments and overwrite the existing document with the result.

Db:

Optional. The name of the database is want the map-reduce operation to write its output. By default this would be the same database as the input collection.

Sharded:

Optional. If true and you have an enabled sharding on output database, the map-reduce operation would shard the output collection using The _id field as the Shard key.

Nonatomic:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.