Interface MapReducePublisher<TResult>
-
- Type Parameters:
TResult
- The type of the result.
- All Superinterfaces:
org.reactivestreams.Publisher<TResult>
public interface MapReducePublisher<TResult> extends org.reactivestreams.Publisher<TResult>
Publisher for map reduce.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MapReducePublisher<TResult>
action(MapReduceAction action)
Specify theMapReduceAction
to be used when writing to a collection.MapReducePublisher<TResult>
batchSize(int batchSize)
Sets the number of documents to return per batch.MapReducePublisher<TResult>
bypassDocumentValidation(Boolean bypassDocumentValidation)
Sets the bypass document level validation flag.MapReducePublisher<TResult>
collation(Collation collation)
Sets the collation optionsMapReducePublisher<TResult>
collectionName(String collectionName)
Sets the collectionName for the output of the MapReduceMapReducePublisher<TResult>
databaseName(String databaseName)
Sets the name of the database to output into.MapReducePublisher<TResult>
filter(Bson filter)
Sets the query filter to apply to the query.MapReducePublisher<TResult>
finalizeFunction(String finalizeFunction)
Sets the JavaScript function that follows the reduce method and modifies the output.org.reactivestreams.Publisher<TResult>
first()
Helper to return a publisher limited to the first result.MapReducePublisher<TResult>
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.MapReducePublisher<TResult>
limit(int limit)
Sets the limit to apply.MapReducePublisher<TResult>
maxTime(long maxTime, TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.MapReducePublisher<TResult>
nonAtomic(boolean nonAtomic)
Sets if the post-processing step will prevent MongoDB from locking the database.MapReducePublisher<TResult>
scope(Bson scope)
Sets the global variables that are accessible in the map, reduce and finalize functions.MapReducePublisher<TResult>
sharded(boolean sharded)
Sets if the output database is shardedMapReducePublisher<TResult>
sort(Bson sort)
Sets the sort criteria to apply to the query.org.reactivestreams.Publisher<Void>
toCollection()
Aggregates documents to a collection according to the specified map-reduce function with the given options, which must specify a non-inline result.MapReducePublisher<TResult>
verbose(boolean verbose)
Sets whether to include the timing information in the result information.
-
-
-
Method Detail
-
collectionName
MapReducePublisher<TResult> collectionName(String collectionName)
Sets the collectionName for the output of the MapReduceThe default action is replace the collection if it exists, to change this use
action(com.mongodb.client.model.MapReduceAction)
.- Parameters:
collectionName
- the name of the collection that you want the map-reduce operation to write its output.- Returns:
- this
-
finalizeFunction
MapReducePublisher<TResult> finalizeFunction(String finalizeFunction)
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
-
scope
MapReducePublisher<TResult> scope(Bson scope)
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
-
sort
MapReducePublisher<TResult> sort(Bson sort)
Sets the sort criteria to apply to the query.- Parameters:
sort
- the sort criteria, which may be null.- Returns:
- this
- MongoDB documentation
- Sort
-
filter
MapReducePublisher<TResult> filter(Bson filter)
Sets the query filter to apply to the query.- Parameters:
filter
- the filter to apply to the query.- Returns:
- this
- MongoDB documentation
- Filter
-
limit
MapReducePublisher<TResult> limit(int limit)
Sets the limit to apply.- Parameters:
limit
- the limit, which may be null- Returns:
- this
- MongoDB documentation
- Limit
-
jsMode
MapReducePublisher<TResult> 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. 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
-
verbose
MapReducePublisher<TResult> verbose(boolean verbose)
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
-
maxTime
MapReducePublisher<TResult> maxTime(long maxTime, TimeUnit timeUnit)
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
-
action
MapReducePublisher<TResult> action(MapReduceAction action)
Specify theMapReduceAction
to be used when writing to a collection.- Parameters:
action
- anMapReduceAction
to perform on the collection- Returns:
- this
-
databaseName
MapReducePublisher<TResult> databaseName(String databaseName)
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
-
sharded
MapReducePublisher<TResult> sharded(boolean sharded)
Sets if the output database is sharded- Parameters:
sharded
- if the output database is sharded- Returns:
- this
- MongoDB documentation
- output with an action
-
nonAtomic
MapReducePublisher<TResult> nonAtomic(boolean nonAtomic)
Sets if the post-processing step will prevent MongoDB from locking the database. Valid only with theMapReduceAction.MERGE
orMapReduceAction.REDUCE
actions.- Parameters:
nonAtomic
- if the post-processing step will prevent MongoDB from locking the database.- Returns:
- this
- MongoDB documentation
- output with an action
-
bypassDocumentValidation
MapReducePublisher<TResult> bypassDocumentValidation(Boolean bypassDocumentValidation)
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:
- 1.2
- MongoDB documentation
- Aggregation
- Since server release
- 3.2
-
toCollection
org.reactivestreams.Publisher<Void> toCollection()
Aggregates documents to a collection according to the specified map-reduce function with the given options, which must specify a non-inline result.- Returns:
- an empty publisher that indicates when the operation has completed
- MongoDB documentation
- Aggregation
-
collation
MapReducePublisher<TResult> collation(Collation collation)
Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 1.3
- Since server release
- 3.4
-
batchSize
MapReducePublisher<TResult> batchSize(int batchSize)
Sets the number of documents to return per batch.Overrides the
Subscription.request(long)
value for setting the batch size, allowing for fine grained control over the underlying cursor.- Parameters:
batchSize
- the batch size- Returns:
- this
- Since:
- 1.8
- MongoDB documentation
- Batch Size
-
first
org.reactivestreams.Publisher<TResult> first()
Helper to return a publisher limited to the first result.- Returns:
- a Publisher which will contain a single item.
- Since:
- 1.8
-
-