TResult
- The type of the result.MongoIterable<TResult>
public interface MapReduceIterable<TResult> extends MongoIterable<TResult>
Modifier and Type | Method | Description |
---|---|---|
MapReduceIterable<TResult> |
action(MapReduceAction action) |
Specify the
MapReduceAction to be used when writing to a collection. |
MapReduceIterable<TResult> |
batchSize(int batchSize) |
Sets the number of documents to return per batch.
|
MapReduceIterable<TResult> |
bypassDocumentValidation(Boolean bypassDocumentValidation) |
Sets the bypass document level validation flag.
|
MapReduceIterable<TResult> |
collation(Collation collation) |
Sets the collation options
|
MapReduceIterable<TResult> |
collectionName(String collectionName) |
Sets the collectionName for the output of the MapReduce
|
MapReduceIterable<TResult> |
databaseName(String databaseName) |
Sets the name of the database to output into.
|
MapReduceIterable<TResult> |
filter(Bson filter) |
Sets the query filter to apply to the query.
|
MapReduceIterable<TResult> |
finalizeFunction(String finalizeFunction) |
Sets the JavaScript function that follows the reduce method and modifies the output.
|
MapReduceIterable<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.
|
MapReduceIterable<TResult> |
limit(int limit) |
Sets the limit to apply.
|
MapReduceIterable<TResult> |
maxTime(long maxTime,
TimeUnit timeUnit) |
Sets the maximum execution time on the server for this operation.
|
MapReduceIterable<TResult> |
nonAtomic(boolean nonAtomic) |
Sets if the post-processing step will prevent MongoDB from locking the database.
|
MapReduceIterable<TResult> |
scope(Bson scope) |
Sets the global variables that are accessible in the map, reduce and finalize functions.
|
MapReduceIterable<TResult> |
sharded(boolean sharded) |
Sets if the output database is sharded
|
MapReduceIterable<TResult> |
sort(Bson sort) |
Sets the sort criteria to apply to the query.
|
void |
toCollection(SingleResultCallback<Void> callback) |
Aggregates documents to a collection according to the specified map-reduce function with the given options, which must specify a
non-inline result.
|
MapReduceIterable<TResult> |
verbose(boolean verbose) |
Sets whether to include the timing information in the result information.
|
batchCursor, first, forEach, getBatchSize, into, map
MapReduceIterable<TResult> collectionName(String collectionName)
The default action is replace the collection if it exists, to change this use action(com.mongodb.client.model.MapReduceAction)
.
collectionName
- the name of the collection that you want the map-reduce operation to write its output.MapReduceIterable<TResult> finalizeFunction(@Nullable String finalizeFunction)
finalizeFunction
- the JavaScript function that follows the reduce method and modifies the output.MapReduceIterable<TResult> scope(@Nullable Bson scope)
scope
- the global variables that are accessible in the map, reduce and finalize functions.MapReduceIterable<TResult> sort(@Nullable Bson sort)
sort
- the sort criteria, which may be null.MapReduceIterable<TResult> filter(@Nullable Bson filter)
filter
- the filter to apply to the query.MapReduceIterable<TResult> limit(int limit)
limit
- the limitMapReduceIterable<TResult> jsMode(boolean jsMode)
jsMode
- the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and
reduce functionsMapReduceIterable<TResult> verbose(boolean verbose)
verbose
- whether to include the timing information in the result information.MapReduceIterable<TResult> maxTime(long maxTime, TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullMapReduceIterable<TResult> action(MapReduceAction action)
MapReduceAction
to be used when writing to a collection.action
- an MapReduceAction
to perform on the collectionMapReduceIterable<TResult> databaseName(@Nullable String databaseName)
databaseName
- the name of the database to output into.MapReduceIterable<TResult> sharded(boolean sharded)
sharded
- if the output database is shardedMapReduceIterable<TResult> nonAtomic(boolean nonAtomic)
MapReduceAction.MERGE
or MapReduceAction.REDUCE
actions.nonAtomic
- if the post-processing step will prevent MongoDB from locking the database.MapReduceIterable<TResult> batchSize(int batchSize)
batchSize
in interface MongoIterable<TResult>
batchSize
- the batch sizeMapReduceIterable<TResult> bypassDocumentValidation(@Nullable Boolean bypassDocumentValidation)
Note: This only applies when an $out stage is specified
.MapReduceIterable<TResult> collation(@Nullable Collation collation)
A null value represents the server default.
collation
- the collation options to usevoid toCollection(SingleResultCallback<Void> callback)
callback
- the callback, which is called when the aggregation completesIllegalStateException
- if a collection name to write the results to has not been specifiedcollectionName(String)