to get total count collection in aggregate mongodb code example Example: mongo count db.collection.countDocuments( <query>, <options> )