Reputation: 163
I'm using PyMongo to access MongoDB and I want to make some speed tests. However, the fact MongoDB uses cache makes it harder for me to do that. I know it's possible to clear cache using the Mongo Shell (I hope that's what I need) - but I can't find how to do that using PyMongo. Is it even possible? Thank you
Upvotes: 4
Views: 4820
Reputation:
Here's how to execute the PlanCache.clear()
command in PyMongo:
db.command(
{
"planCacheClear": "collection_name"
}
)
Upvotes: 1