Answers for "mongodb use count in cond"

2

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
6

mongo count

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

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language