Class AggregationOptions
java.lang.Object
org.springframework.data.mongodb.core.aggregation.AggregationOptions
- All Implemented Interfaces:
ReadConcernAware, ReadPreferenceAware
Holds a set of configurable aggregation options that can be used within an aggregation pipeline. A list of support
aggregation options can be found in the
MongoDB reference documentation.
- Since:
- 1.6
- Author:
- Thomas Darimont, Oliver Gierke, Christoph Strobl, Mark Paluch, Yadhukrishna S Pai, Soumya Prakash Behera
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Builder forAggregationOptions.static enumAggregation pipeline Domain type mappings supported by the mapping layer. -
Constructor Summary
ConstructorsConstructorDescriptionAggregationOptions(boolean allowDiskUse, boolean explain, int cursorBatchSize) Creates a newAggregationOptions.AggregationOptions(boolean allowDiskUse, boolean explain, @Nullable Document cursor) Creates a newAggregationOptions.AggregationOptions(boolean allowDiskUse, boolean explain, @Nullable Document cursor, @Nullable Collation collation) Creates a newAggregationOptions.AggregationOptions(boolean allowDiskUse, boolean explain, @Nullable Document cursor, @Nullable Collation collation, @Nullable String comment) Creates a newAggregationOptions.AggregationOptions(DiskUse diskUse, boolean explain, @Nullable Document cursor) AggregationOptions(DiskUse allowDiskUse, boolean explain, @Nullable Document cursor, @Nullable Collation collation) AggregationOptions(DiskUse allowDiskUse, boolean explain, @Nullable Document cursor, @Nullable Collation collation, @Nullable String comment) -
Method Summary
Modifier and TypeMethodDescriptionstatic AggregationOptions.Builderbuilder()Obtain a newAggregationOptions.Builderfor constructingAggregationOptions.static AggregationOptionsfromDocument(Document document) Creates newAggregationOptionsgivenDocumentcontaining aggregation options.Get collation settings for string comparison.Get the comment for the aggregation.Specify a document that contains options that control the creation of the cursor object.The initial cursor batch size, if available, otherwise null.getHint()Deprecated.Get the hint used to fulfill the aggregation.booleanbooleanbooleanbooleanEnables writing to temporary files.booleanReturn whetherisAllowDiskUse()is configured.booleanSpecifies to return the information on the processing of the pipeline.booleanReturns aDocumentrepresentation of thisAggregationOptions.toString()
-
Constructor Details
-
AggregationOptions
Creates a newAggregationOptions.- Parameters:
allowDiskUse- whether to off-load intensive sort-operations to disk.explain- whether to get the execution plan for the aggregation instead of the actual results.cursor- can be null, used to pass additional options to the aggregation.
-
AggregationOptions
-
AggregationOptions
-
AggregationOptions
public AggregationOptions(boolean allowDiskUse, boolean explain, @Nullable Document cursor, @Nullable Collation collation) Creates a newAggregationOptions.- Parameters:
allowDiskUse- whether to off-load intensive sort-operations to disk.explain- whether to get the execution plan for the aggregation instead of the actual results.cursor- can be null, used to pass additional options (such asbatchSize) to the aggregation.collation- collation for string comparison. Can be null.- Since:
- 2.0
-
AggregationOptions
public AggregationOptions(boolean allowDiskUse, boolean explain, @Nullable Document cursor, @Nullable Collation collation, @Nullable String comment) Creates a newAggregationOptions.- Parameters:
allowDiskUse- whether to off-load intensive sort-operations to disk.explain- whether to get the execution plan for the aggregation instead of the actual results.cursor- can be null, used to pass additional options (such asbatchSize) to the aggregation.collation- collation for string comparison. Can be null.comment- execution comment. Can be null.- Since:
- 2.2
-
AggregationOptions
-
AggregationOptions
public AggregationOptions(boolean allowDiskUse, boolean explain, int cursorBatchSize) Creates a newAggregationOptions.- Parameters:
allowDiskUse- whether to off-load intensive sort-operations to disk.explain- whether to get the execution plan for the aggregation instead of the actual results.cursorBatchSize- initial cursor batch size.- Since:
- 2.0
-
-
Method Details
-
fromDocument
Creates newAggregationOptionsgivenDocumentcontaining aggregation options.- Parameters:
document- must not be null.- Returns:
- the
AggregationOptions. - Since:
- 2.0
-
builder
Obtain a newAggregationOptions.Builderfor constructingAggregationOptions.- Returns:
- never null.
- Since:
- 2.0
-
isAllowDiskUse
public boolean isAllowDiskUse()Enables writing to temporary files. When set to true, aggregation stages can write data to the_tmpsubdirectory in thedbPathdirectory.- Returns:
- true if enabled; false otherwise (or if not set).
-
isAllowDiskUseSet
public boolean isAllowDiskUseSet()Return whetherisAllowDiskUse()is configured.- Returns:
- true if is
allowDiskUseis configured, false otherwise. - Since:
- 4.2.5
-
isExplain
public boolean isExplain()Specifies to return the information on the processing of the pipeline.- Returns:
- true if enabled.
-
getCursorBatchSize
-
getCursor
-
getCollation
-
getComment
-
getHint
Deprecated.since 4.1, usegetHintObject()instead.Get the hint used to fulfill the aggregation.- Returns:
- never null.
- Since:
- 3.1
-
getHintObject
-
hasReadConcern
public boolean hasReadConcern()- Specified by:
hasReadConcernin interfaceReadConcernAware- Returns:
- true if a
ReadConcernis set.
-
getReadConcern
- Specified by:
getReadConcernin interfaceReadConcernAware- Returns:
- the
ReadConcernto apply or null if none set.
-
hasReadPreference
public boolean hasReadPreference()- Specified by:
hasReadPreferencein interfaceReadPreferenceAware- Returns:
- true if a
ReadPreferenceis set.
-
getReadPreference
- Specified by:
getReadPreferencein interfaceReadPreferenceAware- Returns:
- the
ReadPreferenceto apply or null if none set.
-
getMaxTime
- Returns:
- the time limit for processing.
Duration.ZEROis used for the default unbounded behavior. - Since:
- 3.0
-
isSkipResults
public boolean isSkipResults()- Returns:
- true to skip results when running an aggregation. Useful in combination with
$mergeor$out. - Since:
- 3.0.2
-
getDomainTypeMapping
- Returns:
- the domain type mapping strategy do apply. Never null.
- Since:
- 3.2
-
toDocument
Returns aDocumentrepresentation of thisAggregationOptions.- Returns:
- never null.
-
hasExecutionTimeLimit
public boolean hasExecutionTimeLimit()- Returns:
- true if
maxTimeis set to a positive value. - Since:
- 3.0
-
toString
-
getHintObject()instead.