#return the number of documents whose "field" field has a value of A query = db.collection.aggregate([{ "$match": { "field": "A" } },{ "$count": "number of occurrences" }])