Interface MapReduceIterable<TResult>

Type Parameters:
TResult - The type of the result.
All Superinterfaces:
Iterable<TResult>, MongoIterable<TResult>

@Deprecated public interface MapReduceIterable<TResult> extends MongoIterable<TResult>
Deprecated.
Superseded by aggregate
Iterable for map-reduce.

By default, the MapReduceIterable produces the results inline. You can write map-reduce output to a collection by using the collectionName(String) and toCollection() methods.

Since:
3.0
  • Method Details

    • toCollection

      void toCollection()
      Deprecated.
      Aggregates documents to a collection according to the specified map-reduce function with the given options, which must not produce results inline. This method is the preferred alternative to iterator(), cursor(), because this method does what is explicitly requested without executing implicit operations.
      Throws:
      IllegalStateException - if a collection name to write the results to has not been specified
      Since:
      3.4
      See Also:
    • iterator

      MongoCursor<TResult> iterator()
      Deprecated.
      Aggregates documents according to the specified map-reduce function with the given options.
      • If the aggregation produces results inline, then finds all documents in the affected namespace and returns a MongoCursor over them. You may want to use toCollection() instead.
      • Otherwise, returns a MongoCursor producing no elements.
      Specified by:
      iterator in interface Iterable<TResult>
      Specified by:
      iterator in interface MongoIterable<TResult>
      Returns:
      A MongoCursor that must be closed.
    • cursor

      MongoCursor<TResult> cursor()
      Deprecated.
      Aggregates documents according to the specified map-reduce function with the given options.
      • If the aggregation produces results inline, then finds all documents in the affected namespace and returns a MongoCursor over them. You may want to use toCollection() instead.
      • Otherwise, returns a MongoCursor producing no elements.
      Specified by:
      cursor in interface MongoIterable<TResult>
      Returns:
      a cursor equivalent to that returned from MongoIterable.iterator().
    • collectionName

      MapReduceIterable<TResult> collectionName(String collectionName)
      Deprecated.
      Sets the collectionName for the output of the MapReduce

      The 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
      See Also:
    • finalizeFunction

      MapReduceIterable<TResult> finalizeFunction(@Nullable String 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
    • scope

      MapReduceIterable<TResult> scope(@Nullable org.bson.conversions.Bson 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
    • sort

      MapReduceIterable<TResult> sort(@Nullable org.bson.conversions.Bson 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
    • filter

      MapReduceIterable<TResult> filter(@Nullable org.bson.conversions.Bson filter)
      Deprecated.
      Sets the query filter to apply to the query.
      Parameters:
      filter - the filter to apply to the query.
      Returns:
      this
      MongoDB documentation
      Filter
    • limit

      MapReduceIterable<TResult> limit(int limit)
      Deprecated.
      Sets the limit to apply.
      Parameters:
      limit - the limit, which may be null
      Returns:
      this
      MongoDB documentation
      Limit
    • jsMode

      MapReduceIterable<TResult> 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
    • verbose

      MapReduceIterable<TResult> 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
    • maxTime

      MapReduceIterable<TResult> maxTime(long maxTime, TimeUnit timeUnit)
      Deprecated.
      Sets the maximum execution time on the server for this operation.
      Parameters:
      maxTime - the max time
      timeUnit - the time unit, which may not be null
      Returns:
      this
      MongoDB documentation
      Max Time
    • action

      MapReduceIterable<TResult> action(com.mongodb.client.model.MapReduceAction action)
      Deprecated.
      Specify the MapReduceAction to be used when writing to a collection.
      Parameters:
      action - an MapReduceAction to perform on the collection
      Returns:
      this
    • databaseName

      MapReduceIterable<TResult> databaseName(@Nullable 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
    • batchSize

      MapReduceIterable<TResult> batchSize(int batchSize)
      Deprecated.
      Sets the number of documents to return per batch.
      Specified by:
      batchSize in interface MongoIterable<TResult>
      Parameters:
      batchSize - the batch size
      Returns:
      this
      MongoDB documentation
      Batch Size
    • bypassDocumentValidation

      MapReduceIterable<TResult> bypassDocumentValidation(@Nullable 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
      MongoDB documentation
      mapReduce
      Since server release
      3.2
    • collation

      MapReduceIterable<TResult> collation(@Nullable com.mongodb.client.model.Collation collation)
      Deprecated.
      Sets the collation options

      A null value represents the server default.

      Parameters:
      collation - the collation options to use
      Returns:
      this
      Since:
      3.4
      Since server release
      3.4
    • timeoutMode

      @Alpha(CLIENT) MapReduceIterable<TResult> timeoutMode(com.mongodb.client.cursor.TimeoutMode timeoutMode)
      Deprecated.
      Sets the timeoutMode for the cursor.

      Requires the timeout to be set, either in the MongoClientSettings, via MongoDatabase or via MongoCollection

      Parameters:
      timeoutMode - the timeout mode
      Returns:
      this
      Since:
      5.2