CommandStartedEvent::getCommand() not instance of Explainable
I'm trying to build a verbose mode in our MongoDB wrapper library. I was able to implement debug output leveraging CommandSubscriber interface. This part works.
However what I would also like to do is create support for automatic explaining of queries that are being executed. This is not possible due to inconsistency in MongoDB (php) library.
- CommandStartedEvent::getCommand() is not an instance of Explainable interface. It's just a deserialized object. There is no way to fetch the original command object to be able to do explain.
- Neither it is possible to remember such command object when creating it. As these are generated within the library itself. See functions of Collection class for example.