Class AggregationOptions.Builder

java.lang.Object
org.springframework.data.mongodb.core.aggregation.AggregationOptions.Builder
Enclosing class:
AggregationOptions

public static class AggregationOptions.Builder extends Object
A Builder for AggregationOptions.
Author:
Thomas Darimont, Mark Paluch
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • allowDiskUse

      public AggregationOptions.Builder allowDiskUse(boolean allowDiskUse)
      Defines whether to off-load intensive sort-operations to disk.
      Parameters:
      allowDiskUse - use true to allow disk use during the aggregation.
      Returns:
      this.
    • explain

      public AggregationOptions.Builder explain(boolean explain)
      Defines whether to get the execution plan for the aggregation instead of the actual results.
      Parameters:
      explain - use true to enable explain feature.
      Returns:
      this.
    • cursor

      public AggregationOptions.Builder cursor(org.bson.Document cursor)
      Additional options to the aggregation.
      Parameters:
      cursor - must not be null.
      Returns:
      this.
    • cursorBatchSize

      public AggregationOptions.Builder cursorBatchSize(int batchSize)
      Define the initial cursor batch size.
      Parameters:
      batchSize - use a positive int.
      Returns:
      this.
      Since:
      2.0
    • collation

      public AggregationOptions.Builder collation(@Nullable Collation collation)
      Define collation settings for string comparison.
      Parameters:
      collation - can be null.
      Returns:
      this.
      Since:
      2.0
    • comment

      public AggregationOptions.Builder comment(@Nullable String comment)
      Define a comment to describe the execution.
      Parameters:
      comment - can be null.
      Returns:
      this.
      Since:
      2.2
    • hint

      public AggregationOptions.Builder hint(@Nullable org.bson.Document hint)
      Define a hint that is used by query optimizer to to fulfill the aggregation.
      Parameters:
      hint - can be null.
      Returns:
      this.
      Since:
      3.1
    • hint

      public AggregationOptions.Builder hint(@Nullable String indexName)
      Define a hint that is used by query optimizer to to fulfill the aggregation.
      Parameters:
      indexName - can be null.
      Returns:
      this.
      Since:
      4.1
    • readConcern

      public AggregationOptions.Builder readConcern(@Nullable com.mongodb.ReadConcern readConcern)
      Define a ReadConcern to apply to the aggregation.
      Parameters:
      readConcern - can be null.
      Returns:
      this.
      Since:
      4.1
    • readPreference

      public AggregationOptions.Builder readPreference(@Nullable com.mongodb.ReadPreference readPreference)
      Define a ReadPreference to apply to the aggregation.
      Parameters:
      readPreference - can be null.
      Returns:
      this.
      Since:
      4.1
    • maxTime

      public AggregationOptions.Builder maxTime(@Nullable Duration maxTime)
      Set the time limit for processing.
      Parameters:
      maxTime - Duration.ZERO is used for the default unbounded behavior. Negative values will be ignored.
      Returns:
      this.
      Since:
      3.0
    • skipOutput

      public AggregationOptions.Builder skipOutput()
      Run the aggregation, but do NOT read the aggregation result from the store.
      If the expected result of the aggregation is rather large, eg. when using an $out operation, this option allows to execute the aggregation without having the cursor return the operation result.
      Returns:
      this.
      Since:
      3.0.2
    • strictMapping

      public AggregationOptions.Builder strictMapping()
      Apply a strict domain type mapping considering Field annotations throwing errors for non-existent, but referenced fields.
      Returns:
      this.
      Since:
      3.2
    • relaxedMapping

      public AggregationOptions.Builder relaxedMapping()
      Apply a relaxed domain type mapping considering Field annotations using the user provided name if a referenced field does not exist.
      Returns:
      this.
      Since:
      3.2
    • noMapping

      public AggregationOptions.Builder noMapping()
      Apply no domain type mapping at all taking the pipeline as-is.
      Returns:
      this.
      Since:
      3.2
    • build

      public AggregationOptions build()
      Returns a new AggregationOptions instance with the given configuration.
      Returns:
      new instance of AggregationOptions.