from pymongo import MongoClient client = MongoClient() db = client.test # print collection statistics # events is the collection name here print(db.command("collstats", "events")) # print database statistics print(db.command("dbstats"))