Skip to content

Instantly share code, notes, and snippets.

View qjvtenkroode's full-sized avatar
🤔
Hmmm.

Quincey ten Kroode qjvtenkroode

🤔
Hmmm.
  • Qroode
  • The Netherlands
View GitHub Profile
@qjvtenkroode
qjvtenkroode / mongoengine - get db attribute
Created April 20, 2018 11:12
how to do a dbstats with MongoEngine
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')