Class WindowExpressions
- java.lang.Object
 - 
- dev.morphia.aggregation.expressions.WindowExpressions
 
 
- 
public final class WindowExpressions extends Object
Provides window specific operations.- Since:
 - 2.3
 
 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static dev.morphia.aggregation.expressions.impls.ExpressioncovariancePop(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)Returns the population covariance of two numeric expressions that are evaluated using documents in the $setWindowFields stage window.static dev.morphia.aggregation.expressions.impls.ExpressioncovarianceSamp(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)Returns the sample covariance of two numeric expressions that are evaluated using documents in the $setWindowFields stage window.static dev.morphia.aggregation.expressions.impls.ExpressiondenseRank()Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.static dev.morphia.aggregation.expressions.impls.CalculusExpressionderivative(dev.morphia.aggregation.expressions.impls.Expression input)Returns the average rate of change within the specified window.static dev.morphia.aggregation.expressions.impls.ExpressiondocumentNumber()Returns the position of a document (known as the document number) in the $setWindowFields stage partition.static dev.morphia.aggregation.expressions.impls.ExpressionexpMovingAvg(dev.morphia.aggregation.expressions.impls.Expression input, int n)Returns the exponential moving average of numeric expressions applied to documents in a partition defined in the $setWindowFields stage.static dev.morphia.aggregation.expressions.impls.CalculusExpressionintegral(dev.morphia.aggregation.expressions.impls.Expression input)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 dev.morphia.aggregation.expressions.impls.ExpressionlinearFill(dev.morphia.aggregation.expressions.impls.Expression fillValue)Fills null and missing fields in a window using linear interpolation based on surrounding field values.static dev.morphia.aggregation.expressions.impls.Expressionlocf(dev.morphia.aggregation.expressions.impls.Expression fillValue)Last observation carried forward.static dev.morphia.aggregation.expressions.impls.Expressionrank()Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.static dev.morphia.aggregation.expressions.impls.ShiftExpressionshift(dev.morphia.aggregation.expressions.impls.Expression output, long by, dev.morphia.aggregation.expressions.impls.Expression defaultValue)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 dev.morphia.aggregation.expressions.impls.ExpressionstdDevPop(dev.morphia.aggregation.expressions.impls.Expression value, dev.morphia.aggregation.expressions.impls.Expression... additional)Returns the population standard deviation of the input values.static dev.morphia.aggregation.expressions.impls.ExpressionstdDevSamp(dev.morphia.aggregation.expressions.impls.Expression value, dev.morphia.aggregation.expressions.impls.Expression... additional)Returns the sample standard deviation of the input values. 
 - 
 
- 
- 
Method Detail
- 
covariancePop
public static dev.morphia.aggregation.expressions.impls.Expression covariancePop(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)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 expression to evaluatesecond- the second expression to evaluate- Returns:
 - the new expression
 - Since:
 - 2.3
 - See Also:
 Aggregation.setWindowFields(SetWindowFields)- MongoDB documentation
 - Aggregration Expression: $covariancePop
 - Since server release
 - 5.0
 
 
- 
covarianceSamp
public static dev.morphia.aggregation.expressions.impls.Expression covarianceSamp(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)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 expression to evaluatesecond- the second expression to evaluate- Returns:
 - the new expression
 - Since:
 - 2.3
 - See Also:
 Aggregation.setWindowFields(SetWindowFields)- MongoDB documentation
 - Aggregration Expression: $covarianceSamp
 - Since server release
 - 5.0
 
 
- 
denseRank
public static dev.morphia.aggregation.expressions.impls.Expression denseRank()
Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.- Returns:
 - the expression
 - Since:
 - 2.3
 - MongoDB documentation
 - Aggregration Expression: $denseRank
 - Since server release
 - 5.0
 
 
- 
derivative
public static dev.morphia.aggregation.expressions.impls.CalculusExpression derivative(dev.morphia.aggregation.expressions.impls.Expression input)
Returns the average rate of change within the specified window.- Parameters:
 input- Specifies the expression to evaluate. The expression must evaluate to a number.- Returns:
 - the new expression
 - Since:
 - 2.3
 - MongoDB documentation
 - Aggregration Expression: $derivative
 - Since server release
 - 5.0
 
 
- 
documentNumber
public static dev.morphia.aggregation.expressions.impls.Expression 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:
 Aggregation.setWindowFields(SetWindowFields)- MongoDB documentation
 - Aggregration Expression: $documentNumber
 - Since server release
 - 5.0
 
 
- 
expMovingAvg
public static dev.morphia.aggregation.expressions.impls.Expression expMovingAvg(dev.morphia.aggregation.expressions.impls.Expression input, int n)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.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:
 Aggregation.setWindowFields(SetWindowFields)- MongoDB documentation
 - Aggregration Expression: $expMovingAvg
 - Since server release
 - 5.0
 
 
- 
integral
public static dev.morphia.aggregation.expressions.impls.CalculusExpression integral(dev.morphia.aggregation.expressions.impls.Expression input)
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 expression to evaluate. The expression must evaluate to a number.- Returns:
 - the new expression
 - Since:
 - 2.3
 - MongoDB documentation
 - Aggregration Expression: $integral
 - Since server release
 - 5.0
 
 
- 
linearFill
public static dev.morphia.aggregation.expressions.impls.Expression linearFill(dev.morphia.aggregation.expressions.impls.Expression fillValue)
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
 - MongoDB documentation
 - Aggregration Expression: $linearFill
 - Since server release
 - 5.3
 
 
- 
locf
public static dev.morphia.aggregation.expressions.impls.Expression locf(dev.morphia.aggregation.expressions.impls.Expression fillValue)
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
 - MongoDB documentation
 - Aggregration Expression: $locf
 - Since server release
 - 5.2
 
 
- 
rank
public static dev.morphia.aggregation.expressions.impls.Expression 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
 - MongoDB documentation
 - Aggregration Expression: $rank
 - Since server release
 - 5.0
 
 
- 
shift
public static dev.morphia.aggregation.expressions.impls.ShiftExpression shift(dev.morphia.aggregation.expressions.impls.Expression output, long by, dev.morphia.aggregation.expressions.impls.Expression defaultValue)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:
 Aggregation.setWindowFields(SetWindowFields)- MongoDB documentation
 - Aggregration Expression: $shift
 - Since server release
 - 5.0
 
 
- 
stdDevPop
public static dev.morphia.aggregation.expressions.impls.Expression stdDevPop(dev.morphia.aggregation.expressions.impls.Expression value, dev.morphia.aggregation.expressions.impls.Expression... additional)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
 - MongoDB documentation
 - Aggregration Expression: $stdDevPop
 
 
- 
stdDevSamp
public static dev.morphia.aggregation.expressions.impls.Expression stdDevSamp(dev.morphia.aggregation.expressions.impls.Expression value, dev.morphia.aggregation.expressions.impls.Expression... additional)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
 - MongoDB documentation
 - Aggregration Expression: $stdDevSamp
 
 
 - 
 
 -