Created
April 20, 2018 11:12
-
-
Save qjvtenkroode/e5632ee22982f7b4f008288a7c801017 to your computer and use it in GitHub Desktop.
how to do a dbstats with MongoEngine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Credits to @wojcikstefan in this thread: https://github.com/MongoEngine/mongoengine/issues/1056 | |
In [14]: from mongoengine.connection import get_db, connect | |
In [15]: connect('testdb') | |
Out[15]: MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, read_preference=Primary()) | |
In [16]: db = get_db() | |
In [17]: db.command('dbstats') | |
Out[17]: | |
{u'avgObjSize': 905.9408695652174, | |
u'collections': 29, | |
u'dataFileVersion': {u'major': 4, u'minor': 22}, | |
u'dataSize': 1041832.0, | |
u'db': u'testdb', | |
u'extentFreeList': {u'num': 9, u'totalSize': 33509376}, | |
u'fileSize': 67108864.0, | |
u'indexSize': 277984.0, | |
u'indexes': 34, | |
u'nsSizeMB': 16, | |
u'numExtents': 31, | |
u'objects': 1150, | |
u'ok': 1.0, | |
u'storageSize': 1327104.0} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment