Database

[{_id:1,name:"joe",snapshot:null,age:30},{_id:2,name:"joe",snapshot:"snapshot1",age:30},{_id:3,name:"joe",snapshot:"snapshot15",age:30},{_id:4,name:"joe",snapshot:"snapshot23",age:30},]

Query

db.collection.aggregate([{$match:{"snapshot":{$exists:true,$ne:null}}},{$group:{_id:"$name",snapcount:{$sum:1},age:{"$first":"$age"},name:{"$first":"$name"},id:{"$first":"$_id"}}},{"$unset":"_id"}])

Result