public class MapReduceCommand
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
MapReduceCommand.OutputType
INLINE - Return results inline, no result is written to the DB server
REPLACE - Save the job output to a collection, replacing its previous content
MERGE - Merge the job output with the existing contents of outputTarget collection
REDUCE - Reduce the job output with the existing contents of outputTarget collection
|
Constructor and Description |
---|
MapReduceCommand(DBCollection inputCollection,
java.lang.String map,
java.lang.String reduce,
java.lang.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 |
---|---|
void |
addExtraOption(java.lang.String name,
java.lang.Object value) |
DBObject |
getExtraOptions() |
java.lang.String |
getFinalize()
Gets the Finalize JS Function
|
java.lang.String |
getInput()
Get the name of the collection the MapReduce will read from
|
int |
getLimit()
Gets the (optional) limit on input
|
java.lang.String |
getMap()
Get the map function, as a JS String
|
java.lang.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
|
java.lang.String |
getReduce()
Gets the reduce function, as a JS String
|
java.util.Map<java.lang.String,java.lang.Object> |
getScope()
Gets the (optional) JavaScript scope
|
DBObject |
getSort()
Gets the (optional) sort specification object
|
java.lang.Boolean |
isVerbose()
Gets the verbosity of the MapReduce job.
|
void |
setFinalize(java.lang.String finalize)
Sets the Finalize JS Function
|
void |
setLimit(int limit)
Sets the (optional) limit on input
|
void |
setOutputDB(java.lang.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(java.util.Map<java.lang.String,java.lang.Object> scope)
Sets the (optional) JavaScript scope
|
void |
setSort(DBObject sort)
Sets the (optional) sort specification object
|
void |
setVerbose(java.lang.Boolean verbose)
Sets the verbosity of the MapReduce job,
defaults to 'true'
|
DBObject |
toDBObject() |
java.lang.String |
toString() |
public MapReduceCommand(DBCollection inputCollection, java.lang.String map, java.lang.String reduce, java.lang.String outputCollection, MapReduceCommand.OutputType type, DBObject query)
inputCollection
- the collection to read frommap
- map function in javascript codereduce
- reduce function in javascript codeoutputCollection
- optional - leave null if want to get the result inlinetype
- the type of outputquery
- the query to use on inputpublic void setVerbose(java.lang.Boolean verbose)
verbose
- The verbosity level.public java.lang.Boolean isVerbose()
public java.lang.String getInput()
public java.lang.String getMap()
public java.lang.String getReduce()
public java.lang.String getOutputTarget()
public MapReduceCommand.OutputType getOutputType()
public java.lang.String getFinalize()
public void setFinalize(java.lang.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 java.util.Map<java.lang.String,java.lang.Object> getScope()
public void setScope(java.util.Map<java.lang.String,java.lang.Object> scope)
scope
- The JavaScript scopepublic void setOutputDB(java.lang.String outputDB)
outputDB
- public DBObject toDBObject()
public void addExtraOption(java.lang.String name, java.lang.Object value)
public DBObject getExtraOptions()
public void setReadPreference(ReadPreference preference)
ReadPreference
for more information.preference
- Read Preference to usepublic ReadPreference getReadPreference()
public java.lang.String toString()
toString
in class java.lang.Object