Enum MapReduceAction

  • All Implemented Interfaces:
    Serializable, Comparable<MapReduceAction>


    public enum MapReduceAction
    extends Enum<MapReduceAction>
    The map reduce to collection actions.

    These actions are only available when passing out a collection that already exists. This option is not available on secondary members of replica sets. The Enum values dictate what to do with the output collection if it already exists when the map reduce is run.

    Since:
    3.0
    MongoDB documentation
    mapReduce Command
    mapReduce Overview
    • Enum Constant Detail

      • REPLACE

        public static final MapReduceAction REPLACE
        Replace the contents of the collectionName if the collection with the collectionName exists.
      • MERGE

        public static final MapReduceAction MERGE
        Merge the new result with the existing result if the output collection already exists. If an existing document has the same key as the new result, overwrite that existing document.
      • REDUCE

        public static final MapReduceAction REDUCE
        Merge the new result with the existing result if the output collection already exists. If an existing document has the same key as the new result, apply the reduce function to both the new and the existing documents and overwrite the existing document with the result.
    • Method Detail

      • values

        public static MapReduceAction[] values​()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MapReduceAction c : MapReduceAction.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MapReduceAction valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getValue

        public String getValue​()
        Returns:
        the String representation of this Action that the MongoDB server understands