Skip to content

Instantly share code, notes, and snippets.

@johnlpage
Created March 17, 2022 09:33
Show Gist options
  • Save johnlpage/56d869dd9fdc582ba272df73c1d87856 to your computer and use it in GitHub Desktop.
Save johnlpage/56d869dd9fdc582ba272df73c1d87856 to your computer and use it in GitHub Desktop.
[
{ $match: { type: "electric" } },
{
$setWindowFields:
{
sortBy: { date: 1 },
output: {
smoothsumusage: {
$expMovingAvg: { input: { $sum: "$devices.watts"} , alpha: 0.9}
}
}
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment