public class MapReduceOptions extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MapReduceOptions.Action
This option is only available when passing out a collection that already exists.
|
Constructor and Description |
---|
MapReduceOptions()
Constructs a new instance
Sets the options for an inline map-reduce
|
MapReduceOptions(String collectionName)
Constructs a new instance
|
Modifier and Type | Method and Description |
---|---|
MapReduceOptions |
action(MapReduceOptions.Action action)
Specify the
Action to be used when writing to a collection. |
MapReduceOptions |
databaseName(String databaseName)
Sets the name of the database to output into.
|
MapReduceOptions |
filter(Object filter)
Sets the query filter to apply to the query.
|
MapReduceOptions |
finalizeFunction(String finalizeFunction)
Sets the JavaScript function that follows the reduce method and modifies the output.
|
MapReduceOptions.Action |
getAction()
Gets the
Action to be used when writing to a collection. |
String |
getCollectionName()
Gets the name of the collection to output the results to or null if
isInline() . |
String |
getDatabaseName()
Gets the name of the database to output into.
|
Object |
getFilter()
Gets the query filter.
|
String |
getFinalizeFunction()
Gets the JavaScript function that follows the reduce method and modifies the output.
|
int |
getLimit()
Gets the limit to apply.
|
long |
getMaxTime(TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
Object |
getScope()
Gets the global variables that are accessible in the map, reduce and finalize functions.
|
Object |
getSort()
Gets the sort criteria to apply to the query.
|
boolean |
isInline()
Is the output of the map reduce is inline
|
boolean |
isJsMode()
Gets the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and reduce
functions.
|
boolean |
isNonAtomic()
True if the post-processing step will prevent MongoDB from locking the database.
|
boolean |
isSharded()
True if the output database is sharded
|
boolean |
isVerbose()
Gets whether to include the timing information in the result information.
|
MapReduceOptions |
jsMode(boolean jsMode)
Sets the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and reduce
functions.
|
MapReduceOptions |
limit(int limit)
Sets the limit to apply.
|
MapReduceOptions |
maxTime(long maxTime,
TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
MapReduceOptions |
nonAtomic(boolean nonAtomic)
Sets if the post-processing step will prevent MongoDB from locking the database.
|
MapReduceOptions |
scope(Object scope)
Sets the global variables that are accessible in the map, reduce and finalize functions.
|
MapReduceOptions |
sharded(boolean sharded)
Sets if the output database is sharded
|
MapReduceOptions |
sort(Object sort)
Sets the sort criteria to apply to the query.
|
MapReduceOptions |
verbose(boolean verbose)
Sets whether to include the timing information in the result information.
|
public MapReduceOptions()
public boolean isInline()
public String getCollectionName()
isInline()
.isInline()
.public String getFinalizeFunction()
public MapReduceOptions finalizeFunction(String finalizeFunction)
finalizeFunction
- the JavaScript function that follows the reduce method and modifies the output.public Object getScope()
public MapReduceOptions scope(Object scope)
scope
- the global variables that are accessible in the map, reduce and finalize functions.public Object getSort()
public MapReduceOptions sort(Object sort)
sort
- the sort criteria, which may be null.public MapReduceOptions filter(Object filter)
filter
- the filter to apply to the query.public Object getFilter()
public int getLimit()
public MapReduceOptions limit(int limit)
limit
- the limit, which may be nullpublic boolean isJsMode()
public MapReduceOptions jsMode(boolean jsMode)
jsMode
- the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and
reduce functionspublic boolean isVerbose()
public MapReduceOptions verbose(boolean verbose)
verbose
- whether to include the timing information in the result information.public long getMaxTime(TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic MapReduceOptions maxTime(long maxTime, TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic MapReduceOptions.Action getAction()
Action
to be used when writing to a collection.
The default action is replace the collection if it exists, to change this use action
.
Action
to be used when writing to a collection.public MapReduceOptions action(MapReduceOptions.Action action)
Action
to be used when writing to a collection.action
- an MapReduceOptions.Action
to perform on the collectionpublic String getDatabaseName()
public MapReduceOptions databaseName(String databaseName)
databaseName
- the name of the database to output into.public boolean isSharded()
public MapReduceOptions sharded(boolean sharded)
sharded
- if the output database is shardedpublic boolean isNonAtomic()
public MapReduceOptions nonAtomic(boolean nonAtomic)
Action.MERGE
or Action.REDUCE
actions.nonAtomic
- if the post-processing step will prevent MongoDB from locking the database.