|
Hi pieterwjordaanpc@gmail.com,
The drivers CRUD specification no longer specifies that drivers accept generic modifiers (like $explain) as part of the options to find. That is why the mongocxx::options::find class does not have it available. The Q&A in the CRUD spec explains the rationale:
Q: What about explain?
Explain has been determined to be not a normal use-case for a driver. We'd like users to use the shell for this purpose. However, explain is still possible from a driver. For find, it can be passed as a modifier. Aggregate can be run using a runCommand method passing the explain option. In addition, server 3.0 offers an explain command that can be run using a runCommand method.
If you are using a MongoDB server >= 3.0, you can use mongocxx::database::run_command to pass the explain command:
https://docs.mongodb.com/manual/reference/command/explain/
Best,
Kevin
|