Database

db={"SalesInvoice":[{"_id":1,"CustomerID":"1","total":100},{"_id":2,"CustomerID":"1","total":200},{"_id":3,"CustomerID":"3","total":50}]}

Query

db.SalesInvoice.aggregate([{$facet:{salesInvoices:[],filteredCustomers:[{$group:{_id:"$CustomerID",count:{$sum:1}}},{$match:{count:{$gt:1}}},{$project:{_id:1}}]}},{$unwind:"$salesInvoices"},{$match:{$expr:{$in:["$salesInvoices.CustomerID","$filteredCustomers._id"]}}},{$replaceWith:"$salesInvoices"},{$out:"newCollection"}])

Result