import pymongo connect = pymongo.Connection('mongodb://localhost', safe=True) db = connect.test db.command('collStats', 'collection')
Result:
{ u'count': 2, u'ns': u'test.test2', u'ok': 1.0, u'lastExtentSize': 8192, u'avgObjSize': 94.0, u'totalIndexSize': 8176, u'systemFlags': 1, u'userFlags': 0, u'numExtents': 1, u'nindexes': 1, u'storageSize': 8192, u'indexSizes': {u'_id_': 8176}, u'paddingFactor': 1.0, u'size': 188 }
PS test2 As a result, my collection name
source share