Answers for "mongodb aggregate count"

3

mongodb aggregate count

#return the number of documents whose "field" field has a value of A 
query = db.collection.aggregate([{
          "$match": {
            "field": "A"
          }
        },{
          "$count": "number of occurrences"
}])
Posted by: Guest on February-25-2021
3

mongo count

db.collection.countDocuments( <query>, <options> )
Posted by: Guest on May-17-2020

Code answers related to "mongodb aggregate count"

Python Answers by Framework

Browse Popular Code Answers by Language