MongoDB Query Language (MQL) Window Operators
$covariancePop
Calculates the population covariance of two numerical expressions within a specified document window, used in statistical analysis to measure how two variables change together.
$covarianceSamp
Calculates the sample covariance of two numerical expressions within a specified document window, providing unbiased covariance estimate for statistical analysis.
$denseRank
Assigns consecutive ranking positions to documents within a partition based on specified sort order, with no gaps in rank values for tied documents.
$derivative
Calculates the average rate of change of a field between the first and last documents within a specified window, useful for trend analysis.
$documentNumber
Assigns sequential document numbers to each document within a partition based on specified sort order, providing positional ranking.
$expMovingAvg
Calculates the exponential moving average of field values, giving higher weight to recent documents in the calculation for trend analysis.
$integral
Calculates the area under a curve based on specified range of documents sorted by a specific field, useful for cumulative analysis.
$linearFill
Interpolates missing values in a sequence of documents using linear interpolation, useful for filling gaps in time-series or ordered data.
$locf
Propagates the last observed non-null value forward within a partition, useful for filling missing data points in time-series datasets.
$rank
Assigns rank to each document within a partition based on specified sort order, with gaps in ranking for tied values.
$shift
Shifts values within a partition and returns the shifted value, useful for comparing values from adjacent documents in sorted partitions.