Database

[{"_id":NumberLong(301),"telecom":[{"countryCode":{"value":"+1"},"extension":[{"url":"primary","value":["true"]}],"modifiedValue":{"value":"8887778888"},"system":{"value":"email"},"useCode":{"value":"Home Phone"},"value":{"value":"8887778888"}},{"extension":[{"url":"primary","value":["true"]}],"modifiedValue":{"value":"qhammouri@test.com"},"system":{"value":"email"},"useCode":{"value":"work"},"value":{"value":"qhammouri@test.com"}}]}]

Query

db.collection.aggregate([{$match:{telecom:{$elemMatch:{countryCode:{$exists:true},"system.value":"email"}}}},{$project:{count:{$size:{$filter:{input:"$telecom",cond:{$and:[{$ne:[{$type:"$$this.countryCode"},"missing"]},{$eq:["$$this.system.value","email"]}]}}}}}},{$group:{_id:null,count:{$sum:"$count"}}}])

Result