Package com.mongodb.operation
Class MapReduceToCollectionOperation
- java.lang.Object
-
- com.mongodb.operation.MapReduceToCollectionOperation
-
- All Implemented Interfaces:
AsyncWriteOperation<MapReduceStatistics>
,WriteOperation<MapReduceStatistics>
@Deprecated public class MapReduceToCollectionOperation extends Object implements AsyncWriteOperation<MapReduceStatistics>, WriteOperation<MapReduceStatistics>
Deprecated.Operation that runs a Map Reduce against a MongoDB instance. This operation does not support "inline" results, i.e. the results will be output into the collection represented by the MongoNamespace provided.To run a map reduce operation and receive the results inline (i.e. as a response to running the command) use
MapReduceToCollectionOperation
.- Since:
- 3.0
- MongoDB documentation
- Map Reduce
-
-
Constructor Summary
Constructors Constructor Description MapReduceToCollectionOperation(MongoNamespace namespace, BsonJavaScript mapFunction, BsonJavaScript reduceFunction, String collectionName)
Deprecated.Construct a MapReduceOperation with all the criteria it needs to executeMapReduceToCollectionOperation(MongoNamespace namespace, BsonJavaScript mapFunction, BsonJavaScript reduceFunction, String collectionName, WriteConcern writeConcern)
Deprecated.Construct a MapReduceOperation with all the criteria it needs to execute
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MapReduceToCollectionOperation
action(String action)
Deprecated.Sets the output action one of: "replace", "merge", "reduce"ReadOperation<BsonDocument>
asExplainableOperation(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.AsyncReadOperation<BsonDocument>
asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.MapReduceToCollectionOperation
bypassDocumentValidation(Boolean bypassDocumentValidation)
Deprecated.Sets the bypass document level validation flag.MapReduceToCollectionOperation
collation(Collation collation)
Deprecated.Sets the collation optionsMapReduceToCollectionOperation
databaseName(String databaseName)
Deprecated.Sets the name of the database to output into.MapReduceStatistics
execute(WriteBinding binding)
Deprecated.Executing this will return a cursor with your results in.void
executeAsync(AsyncWriteBinding binding, SingleResultCallback<MapReduceStatistics> callback)
Deprecated.General execute which can return anything of type TMapReduceToCollectionOperation
filter(BsonDocument filter)
Deprecated.Sets the filter to apply to the query.MapReduceToCollectionOperation
finalizeFunction(BsonJavaScript finalizeFunction)
Deprecated.Sets the JavaScript function that follows the reduce method and modifies the output.String
getAction()
Deprecated.Gets the output action, one of: "replace", "merge", "reduce".Boolean
getBypassDocumentValidation()
Deprecated.Gets the bypass document level validation flagCollation
getCollation()
Deprecated.Returns the collation optionsString
getCollectionName()
Deprecated.Gets the name of the collection to output the results to.String
getDatabaseName()
Deprecated.Gets the name of the database to output into.BsonDocument
getFilter()
Deprecated.Gets the query filter.BsonJavaScript
getFinalizeFunction()
Deprecated.Gets the JavaScript function that follows the reduce method and modifies the output.int
getLimit()
Deprecated.Gets the limit to apply.BsonJavaScript
getMapFunction()
Deprecated.Gets the JavaScript function that associates or "maps" a value with a key and emits the key and value pair.long
getMaxTime(TimeUnit timeUnit)
Deprecated.Gets the maximum execution time on the server for this operation.MongoNamespace
getNamespace()
Deprecated.Gets the namespace.BsonJavaScript
getReduceFunction()
Deprecated.Gets the JavaScript function that "reduces" to a single object all the values associated with a particular key.BsonDocument
getScope()
Deprecated.Gets the global variables that are accessible in the map, reduce and finalize functions.BsonDocument
getSort()
Deprecated.Gets the sort criteria to apply to the query.WriteConcern
getWriteConcern()
Deprecated.Gets the write concern.boolean
isJsMode()
Deprecated.Gets the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and reduce functions.boolean
isNonAtomic()
Deprecated.True if the post-processing step will prevent MongoDB from locking the database.boolean
isSharded()
Deprecated.True if the output database is shardedboolean
isVerbose()
Deprecated.Gets whether to include the timing information in the result information.MapReduceToCollectionOperation
jsMode(boolean jsMode)
Deprecated.Sets the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and reduce functions.MapReduceToCollectionOperation
limit(int limit)
Deprecated.Sets the limit to apply.MapReduceToCollectionOperation
maxTime(long maxTime, TimeUnit timeUnit)
Deprecated.Sets the maximum execution time on the server for this operation.MapReduceToCollectionOperation
nonAtomic(boolean nonAtomic)
Deprecated.Sets if the post-processing step will prevent MongoDB from locking the database.MapReduceToCollectionOperation
scope(BsonDocument scope)
Deprecated.Sets the global variables that are accessible in the map, reduce and finalize functions.MapReduceToCollectionOperation
sharded(boolean sharded)
Deprecated.Sets if the output database is shardedMapReduceToCollectionOperation
sort(BsonDocument sort)
Deprecated.Sets the sort criteria to apply to the query.MapReduceToCollectionOperation
verbose(boolean verbose)
Deprecated.Sets whether to include the timing information in the result information.
-
-
-
Constructor Detail
-
MapReduceToCollectionOperation
public MapReduceToCollectionOperation(MongoNamespace namespace, BsonJavaScript mapFunction, BsonJavaScript reduceFunction, String collectionName)
Deprecated.Construct a MapReduceOperation with all the criteria it needs to execute- Parameters:
namespace
- the database and collection namespace for the operation.mapFunction
- a JavaScript function that associates or "maps" a value with a key and emits the key and value pair.reduceFunction
- a JavaScript function that "reduces" to a single object all the values associated with a particular key.collectionName
- the name of the collection to output the results to.- MongoDB documentation
- Map Reduce
-
MapReduceToCollectionOperation
public MapReduceToCollectionOperation(MongoNamespace namespace, BsonJavaScript mapFunction, BsonJavaScript reduceFunction, String collectionName, WriteConcern writeConcern)
Deprecated.Construct a MapReduceOperation with all the criteria it needs to execute- Parameters:
namespace
- the database and collection namespace for the operation.mapFunction
- a JavaScript function that associates or "maps" a value with a key and emits the key and value pair.reduceFunction
- a JavaScript function that "reduces" to a single object all the values associated with a particular key.collectionName
- the name of the collection to output the results to.writeConcern
- the write concern- Since:
- 3.4
- MongoDB documentation
- Map Reduce
-
-
Method Detail
-
getNamespace
public MongoNamespace getNamespace()
Deprecated.Gets the namespace.- Returns:
- the namespace
- Since:
- 3.4
-
getMapFunction
public BsonJavaScript getMapFunction()
Deprecated.Gets the JavaScript function that associates or "maps" a value with a key and emits the key and value pair.- Returns:
- the JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
-
getReduceFunction
public BsonJavaScript getReduceFunction()
Deprecated.Gets the JavaScript function that "reduces" to a single object all the values associated with a particular key.- Returns:
- the JavaScript function that "reduces" to a single object all the values associated with a particular key.
-
getCollectionName
public String getCollectionName()
Deprecated.Gets the name of the collection to output the results to.- Returns:
- the name of the collection to output the results to.
-
getWriteConcern
public WriteConcern getWriteConcern()
Deprecated.Gets the write concern.- Returns:
- the write concern, which may be null
- Since:
- 3.4
-
getFinalizeFunction
public BsonJavaScript getFinalizeFunction()
Deprecated.Gets the JavaScript function that follows the reduce method and modifies the output. Default is null- Returns:
- the JavaScript function that follows the reduce method and modifies the output.
- MongoDB documentation
- Requirements for the finalize Function
-
finalizeFunction
public MapReduceToCollectionOperation finalizeFunction(BsonJavaScript finalizeFunction)
Deprecated.Sets the JavaScript function that follows the reduce method and modifies the output.- Parameters:
finalizeFunction
- the JavaScript function that follows the reduce method and modifies the output.- Returns:
- this
- MongoDB documentation
- Requirements for the finalize Function
-
getScope
public BsonDocument getScope()
Deprecated.Gets the global variables that are accessible in the map, reduce and finalize functions.- Returns:
- the global variables that are accessible in the map, reduce and finalize functions.
- MongoDB documentation
- Scope
-
scope
public MapReduceToCollectionOperation scope(BsonDocument scope)
Deprecated.Sets the global variables that are accessible in the map, reduce and finalize functions.- Parameters:
scope
- the global variables that are accessible in the map, reduce and finalize functions.- Returns:
- this
- MongoDB documentation
- mapReduce
-
getFilter
public BsonDocument getFilter()
Deprecated.Gets the query filter.- Returns:
- the query filter
- MongoDB documentation
- Filter
-
filter
public MapReduceToCollectionOperation filter(BsonDocument filter)
Deprecated.Sets the filter to apply to the query.- Parameters:
filter
- the filter to apply to the query.- Returns:
- this
- MongoDB documentation
- Filter
-
getSort
public BsonDocument getSort()
Deprecated.Gets the sort criteria to apply to the query. The default is null, which means that the documents will be returned in an undefined order.- Returns:
- a document describing the sort criteria
- MongoDB documentation
- Sort
-
sort
public MapReduceToCollectionOperation sort(BsonDocument sort)
Deprecated.Sets the sort criteria to apply to the query.- Parameters:
sort
- the sort criteria, which may be null.- Returns:
- this
- MongoDB documentation
- Sort
-
getLimit
public int getLimit()
Deprecated.Gets the limit to apply. The default is null.- Returns:
- the limit
- MongoDB documentation
- Limit
-
limit
public MapReduceToCollectionOperation limit(int limit)
Deprecated.Sets the limit to apply.- Parameters:
limit
- the limit, which may be null- Returns:
- this
- MongoDB documentation
- Limit
-
isJsMode
public boolean isJsMode()
Deprecated.Gets the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and reduce functions. Defaults to false.- Returns:
- jsMode
- MongoDB documentation
- mapReduce
-
jsMode
public MapReduceToCollectionOperation jsMode(boolean jsMode)
Deprecated.Sets the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and reduce functions. Defaults to false.- Parameters:
jsMode
- the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and reduce functions- Returns:
- jsMode
- MongoDB documentation
- mapReduce
-
isVerbose
public boolean isVerbose()
Deprecated.Gets whether to include the timing information in the result information. Defaults to true.- Returns:
- whether to include the timing information in the result information
-
verbose
public MapReduceToCollectionOperation verbose(boolean verbose)
Deprecated.Sets whether to include the timing information in the result information.- Parameters:
verbose
- whether to include the timing information in the result information.- Returns:
- this
-
getMaxTime
public long getMaxTime(TimeUnit timeUnit)
Deprecated.Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time.- Parameters:
timeUnit
- the time unit to return the result in- Returns:
- the maximum execution time in the given time unit
- MongoDB documentation
- Max Time
-
maxTime
public MapReduceToCollectionOperation maxTime(long maxTime, TimeUnit timeUnit)
Deprecated.Sets the maximum execution time on the server for this operation.- Parameters:
maxTime
- the max timetimeUnit
- the time unit, which may not be null- Returns:
- this
- MongoDB documentation
- Max Time
-
getAction
public String getAction()
Deprecated.Gets the output action, one of: "replace", "merge", "reduce". Defaults to "replace".- Returns:
- the output action
- MongoDB documentation
- output with an action
-
action
public MapReduceToCollectionOperation action(String action)
Deprecated.Sets the output action one of: "replace", "merge", "reduce"- Parameters:
action
- the output action- Returns:
- this
- MongoDB documentation
- output with an action
-
getDatabaseName
public String getDatabaseName()
Deprecated.Gets the name of the database to output into.- Returns:
- the name of the database to output into.
-
databaseName
public MapReduceToCollectionOperation databaseName(String databaseName)
Deprecated.Sets the name of the database to output into.- Parameters:
databaseName
- the name of the database to output into.- Returns:
- this
- MongoDB documentation
- output with an action
-
isSharded
public boolean isSharded()
Deprecated.True if the output database is sharded- Returns:
- true if the output database is sharded
- MongoDB documentation
- output with an action
-
sharded
public MapReduceToCollectionOperation sharded(boolean sharded)
Deprecated.Sets if the output database is sharded- Parameters:
sharded
- if the output database is sharded- Returns:
- this
- MongoDB documentation
- output with an action
-
isNonAtomic
public boolean isNonAtomic()
Deprecated.True if the post-processing step will prevent MongoDB from locking the database.- Returns:
- if true the post-processing step will prevent MongoDB from locking the database.
- MongoDB documentation
- output with an action
-
nonAtomic
public MapReduceToCollectionOperation nonAtomic(boolean nonAtomic)
Deprecated.Sets if the post-processing step will prevent MongoDB from locking the database. Valid only with"merge"
or"reduce"
actions.- Parameters:
nonAtomic
- if the post-processing step will prevent MongoDB from locking the database.- Returns:
- this
- MongoDB documentation
- output with an action
-
getBypassDocumentValidation
public Boolean getBypassDocumentValidation()
Deprecated.Gets the bypass document level validation flag- Returns:
- the bypass document level validation flag
- Since:
- 3.2
- Since server release
- 3.2
-
bypassDocumentValidation
public MapReduceToCollectionOperation bypassDocumentValidation(Boolean bypassDocumentValidation)
Deprecated.Sets the bypass document level validation flag.Note: This only applies when an $out stage is specified
.- Parameters:
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.- Returns:
- this
- Since:
- 3.2
- Since server release
- 3.2
-
getCollation
public Collation getCollation()
Deprecated.Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
- Since server release
- 3.4
-
collation
public MapReduceToCollectionOperation collation(Collation collation)
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 3.4
- Since server release
- 3.4
-
execute
public MapReduceStatistics execute(WriteBinding binding)
Deprecated.Executing this will return a cursor with your results in.- Specified by:
execute
in interfaceWriteOperation<MapReduceStatistics>
- Parameters:
binding
- the binding- Returns:
- a MongoCursor that can be iterated over to find all the results of the Map Reduce operation.
-
executeAsync
public void executeAsync(AsyncWriteBinding binding, SingleResultCallback<MapReduceStatistics> callback)
Deprecated.Description copied from interface:AsyncWriteOperation
General execute which can return anything of type T- Specified by:
executeAsync
in interfaceAsyncWriteOperation<MapReduceStatistics>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-
asExplainableOperation
public ReadOperation<BsonDocument> asExplainableOperation(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.- Parameters:
explainVerbosity
- the explain verbosity- Returns:
- a read operation that when executed will explain this operation
-
asExplainableOperationAsync
public AsyncReadOperation<BsonDocument> asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
Deprecated.Gets an operation whose execution explains this operation.- Parameters:
explainVerbosity
- the explain verbosity- Returns:
- a read operation that when executed will explain this operation
-
-