I want to use a customized $sum (lets call it $boolSum) function that returns the number of true element in an array. e.g.
group :{ _id: { a : '$a' b : '$b', c : '$c' }, d1: { $boolSum : '$d1'} d2: { $boolSum : '$d2'} } But it seems that there is no way to define boolSum function. I tried to add a new record in system.js, but it doesn't work.
In MongoDB, is it possible to cutomize function in $group operator of aggregation framework?