Created
May 10, 2016 15:54
-
-
Save trezy/0c057ee419babc0f9eea1787c28749aa to your computer and use it in GitHub Desktop.
Total / successful rescue aggregate
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
[ | |
{ | |
$project: { | |
successful: { | |
$cond: ['$successful', 1, 0] | |
} | |
}, | |
}, { | |
$group: { | |
_id: null, | |
successful: { | |
$sum: "$successful" | |
}, | |
total: { | |
$sum: 1 | |
} | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment