Enum MapReduceAction

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<MapReduceAction>

    public enum MapReduceAction
    extends java.lang.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
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      MERGE
      Merge the new result with the existing result if the output collection already exists.
      REDUCE
      Merge the new result with the existing result if the output collection already exists.
      REPLACE
      Replace the contents of the collectionName if the collection with the collectionName exists.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getValue()  
      static MapReduceAction valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static MapReduceAction[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • 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​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValue

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