Last active
February 24, 2022 12:11
-
-
Save johnlpage/89223a84f29aeab995c51e8828fddd3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
$group: { | |
_id: { | |
date: { | |
$dateTrunc: {date: "$date", unit: "day"} | |
}, | |
type: "$type" | |
}, | |
max: { $max: "$reading" }, | |
min: { $min: "$reading" } | |
} | |
}, { | |
$set: { | |
used: { $subtract: ["$max", "$min"] } | |
} | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment