Using MongoDB 6.0.1 Community and the following query: db.XXXXXX.aggregate([ { "$match": { "status": "done" } }, { "$group": { "_id": null, "done": { "$count": {} } } } ]) It returns the following error: response:Object message:"Unsupported OP_QUERY command: aggregate. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal" But with MongoDB 5.0 it works fine.