Class WindowExpressions
java.lang.Object
dev.morphia.aggregation.expressions.WindowExpressions
Provides window specific operations.
- Since:
- 2.3
-
Method Summary
Modifier and TypeMethodDescriptionstatic Expression
covariancePop
(Object first, Object second) Returns the population covariance of two numeric expressions that are evaluated using documents in the $setWindowFields stage window.static Expression
covarianceSamp
(Object first, Object second) Returns the sample covariance of two numeric expressions that are evaluated using documents in the $setWindowFields stage window.static Expression
Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.static CalculusExpression
derivative
(Object input) Returns the average rate of change within the specified window.static Expression
Returns the position of a document (known as the document number) in the $setWindowFields stage partition.static Expression
expMovingAvg
(Object input, double alpha) Returns the exponential moving average of numeric expressions applied to documents in a partition defined in the $setWindowFields stage.static Expression
expMovingAvg
(Object input, int n) Returns the exponential moving average of numeric expressions applied to documents in a partition defined in the $setWindowFields stage.static CalculusExpression
Returns the approximation of the area under a curve, which is calculated using the trapezoidal rule where each set of adjacent documents form a trapezoid using the:static Expression
linearFill
(Object fillValue) Fills null and missing fields in a window using linear interpolation based on surrounding field values.static Expression
Last observation carried forward.static Expression
rank()
Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.static Expression
Returns the value from an expression applied to a document in a specified position relative to the current document in the $setWindowFields stage partition.static Expression
Returns the population standard deviation of the input values.static Expression
stdDevSamp
(Object value, Object... additional) Returns the sample standard deviation of the input values.
-
Method Details
-
covariancePop
Returns the population covariance of two numeric expressions that are evaluated using documents in the $setWindowFields stage window.$covariancePop is only available in the $setWindowFields stage.
- Parameters:
first
- the first value to evaluatesecond
- the second value to evaluate- Returns:
- the new expression
- Since:
- 2.3
- See Also:
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $covariancePop
-
covarianceSamp
Returns the sample covariance of two numeric expressions that are evaluated using documents in the $setWindowFields stage window.$covarianceSamp is only available in the $setWindowFields stage.
- Parameters:
first
- the first value to evaluatesecond
- the second value to evaluate- Returns:
- the new expression
- Since:
- 2.3
- See Also:
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $covarianceSamp
-
denseRank
Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.- Returns:
- the expression
- Since:
- 2.3
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $denseRank
-
derivative
Returns the average rate of change within the specified window.- Parameters:
input
- Specifies the value to evaluate. If an expression, it must evaluate to a number.- Returns:
- the new expression
- Since:
- 2.3
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $derivative
-
documentNumber
Returns the position of a document (known as the document number) in the $setWindowFields stage partition.- Returns:
- the new expression
- Since:
- 2.3
- See Also:
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $documentNumber
-
expMovingAvg
Returns the exponential moving average of numeric expressions applied to documents in a partition defined in the $setWindowFields stage.$expMovingAvg is only available in the $setWindowFields stage.
- Parameters:
input
- Specifies the value to evaluate. Non-numeric expressions are ignored.n
- An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight.- Returns:
- the new expression
- Since:
- 2.3
- See Also:
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $expMovingAvg
-
expMovingAvg
Returns the exponential moving average of numeric expressions applied to documents in a partition defined in the $setWindowFields stage.$expMovingAvg is only available in the $setWindowFields stage.
- Parameters:
input
- Specifies the expression to evaluate. Non-numeric expressions are ignored.alpha
- A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation.- Returns:
- the new expression
- Since:
- 2.3
- See Also:
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $expMovingAvg
-
integral
Returns the approximation of the area under a curve, which is calculated using the trapezoidal rule where each set of adjacent documents form a trapezoid using the:- Parameters:
input
- Specifies the value to evaluate. If an expression, it must evaluate to a number.- Returns:
- the new expression
- Since:
- 2.3
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $integral
-
linearFill
Fills null and missing fields in a window using linear interpolation based on surrounding field values.$linearFill is only available in the $setWindowFields stage.
- Parameters:
fillValue
- the expression to use when calculating fill values- Returns:
- the fill expression
- Since:
- 2.3
- Since server release
- 5.3
- MongoDB documentation
- Aggregration Expression: $linearFill
-
locf
Last observation carried forward. Set values for null and missing fields in a window to the last non-null value for the field.- Parameters:
fillValue
- the expression to use when calculating fill values- Returns:
- the fill expression
- Since:
- 2.3
- Since server release
- 5.2
- MongoDB documentation
- Aggregration Expression: $locf
-
rank
Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.- Returns:
- the new expression
- Since:
- 2.3
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $rank
-
shift
Returns the value from an expression applied to a document in a specified position relative to the current document in the $setWindowFields stage partition.- Parameters:
output
- Specifies an expression to evaluate and return in the output.by
- Specifies an integer with a numeric document position relative to the current document in the output.defaultValue
- Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition.- Returns:
- the expression
- Since:
- 2.3
- See Also:
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $shift
-
stdDevPop
Returns the population standard deviation of the input values.- Parameters:
value
- the valueadditional
- any subsequent expressions to include in the expression- Returns:
- the new expression
- Since:
- 2.3
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $stdDevPop
-
stdDevSamp
Returns the sample standard deviation of the input values.- Parameters:
value
- the valueadditional
- any subsequent expressions to include in the expression- Returns:
- the new expression
- Since:
- 2.3
- Since server release
- 5.0
- MongoDB documentation
- Aggregration Expression: $stdDevSamp
-