Module spring.data.mongodb
Class AggregationOptions.Builder
java.lang.Object
org.springframework.data.mongodb.core.aggregation.AggregationOptions.Builder
- Enclosing class:
- AggregationOptions
A Builder for
AggregationOptions.- Author:
- Thomas Darimont, Mark Paluch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowDiskUse(boolean allowDiskUse) Defines whether to off-load intensive sort-operations to disk.build()Returns a newAggregationOptionsinstance with the given configuration.Define collation settings for string comparison.Define a comment to describe the execution.cursor(org.bson.Document cursor) Additional options to the aggregation.cursorBatchSize(int batchSize) Define the initial cursor batch size.explain(boolean explain) Defines whether to get the execution plan for the aggregation instead of the actual results.Define a hint that is used by query optimizer to to fulfill the aggregation.hint(org.bson.Document hint) Define a hint that is used by query optimizer to to fulfill the aggregation.Set the time limit for processing.Apply no domain type mapping at all taking the pipeline as-is.readConcern(com.mongodb.ReadConcern readConcern) Define aReadConcernto apply to the aggregation.readPreference(com.mongodb.ReadPreference readPreference) Define aReadPreferenceto apply to the aggregation.Apply a relaxed domain type mapping consideringFieldannotations using the user provided name if a referenced field does not exist.Run the aggregation, but do NOT read the aggregation result from the store.Apply a strict domain type mapping consideringFieldannotations throwing errors for non-existent, but referenced fields.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
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
Additional options to the aggregation.- Parameters:
cursor- must not be null.- Returns:
- this.
-
cursorBatchSize
Define the initial cursor batch size.- Parameters:
batchSize- use a positive int.- Returns:
- this.
- Since:
- 2.0
-
collation
Define collation settings for string comparison.- Parameters:
collation- can be null.- Returns:
- this.
- Since:
- 2.0
-
comment
Define a comment to describe the execution.- Parameters:
comment- can be null.- Returns:
- this.
- Since:
- 2.2
-
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
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
Define aReadConcernto 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 aReadPreferenceto apply to the aggregation.- Parameters:
readPreference- can be null.- Returns:
- this.
- Since:
- 4.1
-
maxTime
Set the time limit for processing.- Parameters:
maxTime-Duration.ZEROis used for the default unbounded behavior.Negativevalues will be ignored.- Returns:
- this.
- Since:
- 3.0
-
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
Apply a strict domain type mapping consideringFieldannotations throwing errors for non-existent, but referenced fields.- Returns:
- this.
- Since:
- 3.2
-
relaxedMapping
Apply a relaxed domain type mapping consideringFieldannotations using the user provided name if a referenced field does not exist.- Returns:
- this.
- Since:
- 3.2
-
noMapping
Apply no domain type mapping at all taking the pipeline as-is.- Returns:
- this.
- Since:
- 3.2
-
build
Returns a newAggregationOptionsinstance with the given configuration.- Returns:
- new instance of
AggregationOptions.
-