monger icon indicating copy to clipboard operation
monger copied to clipboard

Execution Stats in Aggregate

Open arichiardi opened this issue 5 years ago • 2 comments

Hi there!

Still new to Mongo but I wanted to get the execution time of my aggregate queries and while I am using explain-aggregate function, I cannot really see the executionStats section returned from it.

My Mongo is from the 3.6.17-xenial docker image.

Is there any way to access that information?

arichiardi avatar Apr 01 '20 01:04 arichiardi

I found that this article would actually work but how to chain calls in monger?

https://dzone.com/articles/mongo-aggregates-and-how-to-explain-aggregate-quer

arichiardi avatar Apr 01 '20 01:04 arichiardi

as the article suggests you have to run explain with the executionStats option which unfortunately doesn't seem to be supported by the java driver :'( here the api only allows AggregateOptions not any explain options. You could potentially profile your query using the MongoDB shell and then using it in your clojure application. if you really want to do it in clojure you can manually use the raw runCommand interface through java interrop but that would be a bit painful.

mjrb avatar Sep 04 '21 13:09 mjrb