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",}}}}])

Result