class MapReduceIterableImpl<TDocument,TResult> extends MongoIterableImpl<TResult> implements MapReduceIterable<TResult>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MapReduceIterableImpl.WrappedMapReduceReadOperation<TResult> |
(package private) static class |
MapReduceIterableImpl.WrappedMapReduceWriteOperation |
Modifier and Type | Field and Description |
---|---|
private MapReduceAction |
action |
private java.lang.Boolean |
bypassDocumentValidation |
private CodecRegistry |
codecRegistry |
private Collation |
collation |
private java.lang.String |
collectionName |
private java.lang.String |
databaseName |
private java.lang.Class<TDocument> |
documentClass |
private Bson |
filter |
private java.lang.String |
finalizeFunction |
private boolean |
inline |
private boolean |
jsMode |
private int |
limit |
private java.lang.String |
mapFunction |
private long |
maxTimeMS |
private MongoNamespace |
namespace |
private boolean |
nonAtomic |
private java.lang.String |
reduceFunction |
private java.lang.Class<TResult> |
resultClass |
private Bson |
scope |
private boolean |
sharded |
private Bson |
sort |
private boolean |
verbose |
private WriteConcern |
writeConcern |
Constructor and Description |
---|
MapReduceIterableImpl(ClientSession clientSession,
MongoNamespace namespace,
java.lang.Class<TDocument> documentClass,
java.lang.Class<TResult> resultClass,
CodecRegistry codecRegistry,
ReadPreference readPreference,
ReadConcern readConcern,
WriteConcern writeConcern,
AsyncOperationExecutor executor,
java.lang.String mapFunction,
java.lang.String reduceFunction) |
Modifier and Type | Method and Description |
---|---|
MapReduceIterable<TResult> |
action(MapReduceAction action)
Specify the
MapReduceAction to be used when writing to a collection. |
(package private) AsyncReadOperation<AsyncBatchCursor<TResult>> |
asAsyncReadOperation() |
MapReduceIterable<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
MapReduceIterable<TResult> |
bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets the bypass document level validation flag.
|
MapReduceIterable<TResult> |
collation(Collation collation)
Sets the collation options
|
MapReduceIterable<TResult> |
collectionName(java.lang.String collectionName)
Sets the collectionName for the output of the MapReduce
|
private FindOperation<TResult> |
createFindOperation() |
private MapReduceIterableImpl.WrappedMapReduceReadOperation<TResult> |
createMapReduceInlineOperation() |
private MapReduceIterableImpl.WrappedMapReduceWriteOperation |
createMapReduceToCollectionOperation() |
MapReduceIterable<TResult> |
databaseName(java.lang.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(java.lang.String finalizeFunction)
Sets the JavaScript function that follows the reduce method and modifies the output.
|
(package private) ReadPreference |
getReadPreference() |
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,
java.util.concurrent.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<java.lang.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, getClientSession, getExecutor, getReadConcern, into, map, toBsonDocumentOrNull, toBsonDocumentOrNull
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
batchCursor, first, forEach, into, map
private final MongoNamespace namespace
private final java.lang.Class<TDocument> documentClass
private final java.lang.Class<TResult> resultClass
private final CodecRegistry codecRegistry
private final WriteConcern writeConcern
private final java.lang.String mapFunction
private final java.lang.String reduceFunction
private boolean inline
private java.lang.String collectionName
private java.lang.String finalizeFunction
private Bson scope
private Bson filter
private Bson sort
private int limit
private boolean jsMode
private boolean verbose
private long maxTimeMS
private MapReduceAction action
private java.lang.String databaseName
private boolean sharded
private boolean nonAtomic
private java.lang.Boolean bypassDocumentValidation
private Collation collation
MapReduceIterableImpl(ClientSession clientSession, MongoNamespace namespace, java.lang.Class<TDocument> documentClass, java.lang.Class<TResult> resultClass, CodecRegistry codecRegistry, ReadPreference readPreference, ReadConcern readConcern, WriteConcern writeConcern, AsyncOperationExecutor executor, java.lang.String mapFunction, java.lang.String reduceFunction)
public MapReduceIterable<TResult> collectionName(java.lang.String collectionName)
MapReduceIterable
The default action is replace the collection if it exists, to change this use MapReduceIterable.action(com.mongodb.client.model.MapReduceAction)
.
collectionName
in interface MapReduceIterable<TResult>
collectionName
- the name of the collection that you want the map-reduce operation to write its output.public MapReduceIterable<TResult> finalizeFunction(java.lang.String finalizeFunction)
MapReduceIterable
finalizeFunction
in interface MapReduceIterable<TResult>
finalizeFunction
- the JavaScript function that follows the reduce method and modifies the output.public MapReduceIterable<TResult> scope(Bson scope)
MapReduceIterable
scope
in interface MapReduceIterable<TResult>
scope
- the global variables that are accessible in the map, reduce and finalize functions.public MapReduceIterable<TResult> sort(Bson sort)
MapReduceIterable
sort
in interface MapReduceIterable<TResult>
sort
- the sort criteria, which may be null.public MapReduceIterable<TResult> filter(Bson filter)
MapReduceIterable
filter
in interface MapReduceIterable<TResult>
filter
- the filter to apply to the query.public MapReduceIterable<TResult> limit(int limit)
MapReduceIterable
limit
in interface MapReduceIterable<TResult>
limit
- the limit, which may be nullpublic MapReduceIterable<TResult> jsMode(boolean jsMode)
MapReduceIterable
jsMode
in interface MapReduceIterable<TResult>
jsMode
- the flag that specifies whether to convert intermediate data into BSON format between the execution of the map and
reduce functionspublic MapReduceIterable<TResult> verbose(boolean verbose)
MapReduceIterable
verbose
in interface MapReduceIterable<TResult>
verbose
- whether to include the timing information in the result information.public MapReduceIterable<TResult> maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
MapReduceIterable
maxTime
in interface MapReduceIterable<TResult>
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic MapReduceIterable<TResult> action(MapReduceAction action)
MapReduceIterable
MapReduceAction
to be used when writing to a collection.action
in interface MapReduceIterable<TResult>
action
- an MapReduceAction
to perform on the collectionpublic MapReduceIterable<TResult> databaseName(java.lang.String databaseName)
MapReduceIterable
databaseName
in interface MapReduceIterable<TResult>
databaseName
- the name of the database to output into.public MapReduceIterable<TResult> sharded(boolean sharded)
MapReduceIterable
sharded
in interface MapReduceIterable<TResult>
sharded
- if the output database is shardedpublic MapReduceIterable<TResult> nonAtomic(boolean nonAtomic)
MapReduceIterable
MapReduceAction.MERGE
or MapReduceAction.REDUCE
actions.nonAtomic
in interface MapReduceIterable<TResult>
nonAtomic
- if the post-processing step will prevent MongoDB from locking the database.public MapReduceIterable<TResult> batchSize(int batchSize)
MongoIterable
batchSize
in interface MapReduceIterable<TResult>
batchSize
in interface MongoIterable<TResult>
batchSize
in class MongoIterableImpl<TResult>
batchSize
- the batch sizepublic MapReduceIterable<TResult> bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
MapReduceIterable
Note: This only applies when an $out stage is specified
.bypassDocumentValidation
in interface MapReduceIterable<TResult>
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.public MapReduceIterable<TResult> collation(Collation collation)
MapReduceIterable
A null value represents the server default.
collation
in interface MapReduceIterable<TResult>
collation
- the collation options to usepublic void toCollection(SingleResultCallback<java.lang.Void> callback)
MapReduceIterable
toCollection
in interface MapReduceIterable<TResult>
callback
- the callback, which is called when the aggregation completesMapReduceIterable.collectionName(String)
ReadPreference getReadPreference()
getReadPreference
in class MongoIterableImpl<TResult>
AsyncReadOperation<AsyncBatchCursor<TResult>> asAsyncReadOperation()
asAsyncReadOperation
in class MongoIterableImpl<TResult>
private MapReduceIterableImpl.WrappedMapReduceReadOperation<TResult> createMapReduceInlineOperation()
private MapReduceIterableImpl.WrappedMapReduceWriteOperation createMapReduceToCollectionOperation()
private FindOperation<TResult> createFindOperation()