public class MapReduceCommand extends Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | MapReduceCommand.OutputTypeRepresents the different options available for outputting the results of a map-reduce operation. | 
| Constructor and Description | 
|---|
| MapReduceCommand(DBCollection inputCollection,
                String map,
                String reduce,
                String outputCollection,
                MapReduceCommand.OutputType type,
                DBObject query)Represents the command for a map reduce operation Runs the command in REPLACE output type to a named collection | 
| Modifier and Type | Method and Description | 
|---|---|
| Boolean | getBypassDocumentValidation()Gets whether to bypass document validation, or null if unspecified. | 
| Collation | getCollation()Returns the collation | 
| String | getFinalize()Gets the Finalize JS Function | 
| String | getInput()Get the name of the collection the MapReduce will read from | 
| Boolean | getJsMode()Gets the (optional) JavaScript mode | 
| int | getLimit()Gets the (optional) limit on input | 
| String | getMap()Get the map function, as a JS String | 
| long | getMaxTime(TimeUnit timeUnit)Gets the max execution time for this command, in the given time unit. | 
| String | getOutputDB()Gets the (optional) database name where the output collection should reside | 
| String | getOutputTarget()Gets the output target (name of collection to save to) This value is nullable only if OutputType is set to INLINE | 
| MapReduceCommand.OutputType | getOutputType()Gets the OutputType for this instance. | 
| DBObject | getQuery()Gets the query to run for this MapReduce job | 
| ReadPreference | getReadPreference()Gets the read preference | 
| String | getReduce()Gets the reduce function, as a JS String | 
| Map<String,Object> | getScope()Gets the (optional) JavaScript  scope | 
| DBObject | getSort()Gets the (optional) sort specification object | 
| Boolean | isVerbose()Gets the verbosity of the MapReduce job. | 
| void | setBypassDocumentValidation(Boolean bypassDocumentValidation)Sets whether to bypass document validation. | 
| void | setCollation(Collation collation)Sets the collation options | 
| void | setFinalize(String finalize)Sets the Finalize JS Function | 
| void | setJsMode(Boolean jsMode)Sets the (optional) JavaScript Mode | 
| void | setLimit(int limit)Sets the (optional) limit on input | 
| void | setMaxTime(long maxTime,
          TimeUnit timeUnit)Sets the max execution time for this command, in the given time unit. | 
| void | setOutputDB(String outputDB)Sets the (optional) database name where the output collection should reside | 
| void | setReadPreference(ReadPreference preference)Sets the read preference for this command. | 
| void | setScope(Map<String,Object> scope)Sets the (optional) JavaScript scope | 
| void | setSort(DBObject sort)Sets the (optional) sort specification object | 
| void | setVerbose(Boolean verbose)Sets the verbosity of the MapReduce job, defaults to 'true' | 
| DBObject | toDBObject()Turns this command into a DBObject representation of this map reduce command. | 
| String | toString() | 
public MapReduceCommand(DBCollection inputCollection, String map, String reduce, String outputCollection, MapReduceCommand.OutputType type, DBObject query)
inputCollection - collection to use as the source documents to perform the map reduce operation.map - a JavaScript function that associates or "maps" a value with a key and emits the key and value pair.reduce - a JavaScript function that "reduces" to a single object all the values associated with a particular key.outputCollection - optional - leave null if want to get the result inlinetype - the type of outputquery - specifies the selection criteria using query operators for determining the documents input to the map
                         function.public void setVerbose(Boolean verbose)
verbose - The verbosity level.public Boolean isVerbose()
public String getInput()
public String getMap()
public String getReduce()
public String getOutputTarget()
public MapReduceCommand.OutputType getOutputType()
public String getFinalize()
public void setFinalize(String finalize)
finalize - The finalize function (as a JS String)public DBObject getQuery()
public DBObject getSort()
public void setSort(DBObject sort)
sort - The sort specification objectpublic int getLimit()
public void setLimit(int limit)
limit - The limit specification objectpublic long getMaxTime(TimeUnit timeUnit)
timeUnit - the time unit to return the value in.public void setMaxTime(long maxTime,
                       TimeUnit timeUnit)
maxTime - the maximum execution time. A non-zero value requires a server version >= 2.6timeUnit - the time unit that maxTime is specified inpublic Map<String,Object> getScope()
public void setScope(Map<String,Object> scope)
scope - The JavaScript scopepublic Boolean getJsMode()
public void setJsMode(Boolean jsMode)
jsMode - Specifies whether to convert intermediate data into BSON format between the execution of the map and reduce functionspublic String getOutputDB()
public void setOutputDB(String outputDB)
outputDB - the name of the database to send the Map Reduce output topublic Boolean getBypassDocumentValidation()
public void setBypassDocumentValidation(Boolean bypassDocumentValidation)
bypassDocumentValidation - whether to bypass document validation, or null if unspecifiedpublic DBObject toDBObject()
public void setReadPreference(ReadPreference preference)
ReadPreference for more information.preference - Read Preference to usepublic ReadPreference getReadPreference()
public Collation getCollation()
public void setCollation(Collation collation)
collation - the collation options