how to fetch data from mongodb and set it to count code example Example: mongo count db.collection.countDocuments( <query>, <options> )