Answers for "mongodb aggregate match multiple nested"

3

mongodb match multiple nested

// Use $elemMatch
Model.findOne({
	views: {
       $elemMatch: {
           year: 2012,
           month: 6 
       }
    }
}, {
	'views.$': 1
})
Posted by: Guest on October-14-2021
0

mongodb aggregate over nested fields

> db.demo99.aggregate([ { $project: { Count: { $objectToArray: "$Details" } } }, { $unwind: "$Count" }, { $group: { _id: "$Count.k", count: { $sum: "$Count.v.Number"} } } ])
Posted by: Guest on October-22-2020

Code answers related to "mongodb aggregate match multiple nested"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language