Documents are stored with the following fields:
_id: NumberofChildren: Integer OwnsAHome: Boolean Income: Integer
I need to use an aggregation structure to sort by the number of children, so the result looks something like this:
Number of Children: 3 Number of People: some value, say 17 Number of People who own a home: some value less than 17 which is a sum of the number of true Booleans Average income: some value
How would this be done in MongoDB with aggregation , especially with respect to counting the number of times Boolean OwnsAHome is true ?
Thanks!
mongodb aggregation-framework
jfeng92
source share