I am trying analyze my query performances and would like improve them. I use mongoengine wrapper. I am not able find way to use explain() from mongoengine although I am using query logs and getting the raw mongo queries and running explain I would like to use explain via mongoengine to make my monitoring less cumbersome. Any ideas
MongoDB keeps most recently used data in RAM. If you have created indexes for your queries and your working data set fits in RAM, MongoDB serves all queries from memory. MongoDB does not cache the query results in order to return the cached results for identical queries.
You can use read operations to retrieve data from your MongoDB database. There are multiple types of read operations that access the data in different ways. If you want to request results based on a set of criteria from the existing set of data, you can use a find operation such as the find() or findOne() methods.
Both PyMongo and MongoEngine can be used to access data from a MongoDB database. However, they work in very different ways and offer different features. PyMongo is the MongoDB recommended library. It makes it easy to use MongoDB documents and maps directly to the familiar MongoDB Query Language.
You can use explain eg:
MyDoc.objects(x=y).explain()
See: QuerySet.explain()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With