Database

[{"total":12345.45,"fecha_venta":new Date("2019-01-15"),"factura":"00001"},{"total":19875.45,"fecha_venta":new Date("2019-02-02"),"factura":"00002"},{"total":145.25,"fecha_venta":new Date("2019-02-16"),"factura":"00003"},{"total":2875.05,"fecha_venta":new Date("2020-01-11"),"factura":"00004"},{"total":1265.00,"fecha_venta":new Date("2020-02-05"),"factura":"00005"},{"total":365.19,"fecha_venta":new Date("2020-02-19"),"factura":"00006"},{"total":895.00,"fecha_venta":new Date("2020-03-01"),"factura":"00007"},]

Query

db.collection.aggregate([{$group:{_id:{year:{$year:"$fecha_venta"},mes:{$month:"$fecha_venta"}},ventas:{$push:{total:"$total",}}}},{$project:{_id:0,year:"$_id.year",mes:"$_id.mes",total:{$reduce:{input:"$ventas",initialValue:0,in:{$sum:["$$value","$$this.total"]}}}}},{$group:{_id:"$year",ventas:{$push:{mes:"$mes",total:"$total"}}}}])

Result