public class MapReduceCommand
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MapReduceCommand.OutputType
Represents the different options available for outputting the results of a map-reduce operation.
|
| 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 |
|---|---|
java.lang.Boolean |
getBypassDocumentValidation()
Gets whether to bypass document validation, or null if unspecified.
|
Collation |
getCollation()
Returns the collation
|
java.lang.String |
getFinalize()
Gets the Finalize JS Function
|
java.lang.String |
getInput()
Get the name of the collection the MapReduce will read from
|
java.lang.Boolean |
getJsMode()
Gets the (optional) JavaScript mode
|
int |
getLimit()
Gets the (optional) limit on input
|
java.lang.String |
getMap()
Get the map function, as a JS String
|
long |
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the max execution time for this command, in the given time unit.
|
java.lang.String |
getOutputDB()
Gets the (optional) database name where the output collection should reside
|
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 |
setBypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets whether to bypass document validation.
|
void |
setCollation(Collation collation)
Sets the collation options
|
void |
setFinalize(java.lang.String finalize)
Sets the Finalize JS Function
|
void |
setJsMode(java.lang.Boolean jsMode)
Sets the (optional) JavaScript Mode
|
void |
setLimit(int limit)
Sets the (optional) limit on input
|
void |
setMaxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the max execution time for this command, in the given time unit.
|
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()
Turns this command into a DBObject representation of this map reduce command.
|
java.lang.String |
toString() |
public MapReduceCommand(DBCollection inputCollection, java.lang.String map, java.lang.String reduce, @Nullable java.lang.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(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()
@Nullable public java.lang.String getOutputTarget()
public MapReduceCommand.OutputType getOutputType()
@Nullable public java.lang.String getFinalize()
public void setFinalize(@Nullable
java.lang.String finalize)
finalize - The finalize function (as a JS String)@Nullable public DBObject getQuery()
@Nullable public DBObject getSort()
public void setSort(@Nullable
DBObject sort)
sort - The sort specification objectpublic int getLimit()
public void setLimit(int limit)
limit - The limit specification objectpublic long getMaxTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit - the time unit to return the value in.public void setMaxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
maxTime - the maximum execution time. A non-zero value requires a server version >= 2.6timeUnit - the time unit that maxTime is specified in@Nullable public java.util.Map<java.lang.String,java.lang.Object> getScope()
public void setScope(@Nullable
java.util.Map<java.lang.String,java.lang.Object> scope)
scope - The JavaScript scope@Nullable public java.lang.Boolean getJsMode()
public void setJsMode(@Nullable
java.lang.Boolean jsMode)
jsMode - Specifies whether to convert intermediate data into BSON format between the execution of the map and reduce functions@Nullable public java.lang.String getOutputDB()
public void setOutputDB(@Nullable
java.lang.String outputDB)
outputDB - the name of the database to send the Map Reduce output to@Nullable public java.lang.Boolean getBypassDocumentValidation()
public void setBypassDocumentValidation(@Nullable
java.lang.Boolean bypassDocumentValidation)
bypassDocumentValidation - whether to bypass document validation, or null if unspecifiedpublic DBObject toDBObject()
public void setReadPreference(@Nullable
ReadPreference preference)
ReadPreference for more information.preference - Read Preference to use@Nullable public ReadPreference getReadPreference()
@Nullable public Collation getCollation()
@Nullable public void setCollation(Collation collation)
collation - the collation optionspublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2010 - 2023 Adobe. All Rights Reserved