[JAVA-3909] Add explain helpers Created: 14/Dec/20  Updated: 28/Oct/23  Resolved: 06/Jan/21

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: None
Fix Version/s: 4.2.0

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
Backwards Compatibility: Minor Change
Documentation Changes: Needed

 Description   

Add explain helper methods for find and aggregate.

A helper for explaining a find command is particularly important, as the 3.x driver supported explain via the $explain modifier, which has been removed in 4.0. An explain helper will provide an upgrade path for applications that are relying on explain support via modifiers.



 Comments   
Comment by Yann Simon [ 13/Jan/21 ]

I am curious though about the circumstances in which you use explain. What sort of program uses it? My expectation is that it's used during development but not in production, but I'd like to understand more about your use case.

You're right, we don't use it on production.

Only when running the application locally or in some test environments, we check if a query is doing a collection scan, and we log it to be able to fix that.

Comment by Jeffrey Yemin [ 13/Jan/21 ]

yann.simon.fr@gmail.com

I am curious though about the circumstances in which you use explain. What sort of program uses it? My expectation is that it's used during development but not in production, but I'd like to understand more about your use case.

Comment by Jeffrey Yemin [ 13/Jan/21 ]

Hi yann.simon.fr@gmail.com,

We're really trying to hold the line on not doing another feature release on the 3.x branch, and adding new methods like this to the public API would require that. I don't think explain support is quite enough to warrant it, but if we decide to release 3.13.0 for other reasons we will consider backporting this as well.

Comment by Yann Simon [ 13/Jan/21 ]

Should we also have this helper in the 3.x driver to ease the upgrade process?

Comment by Githook User [ 11/Jan/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add reference docs for explain of find and aggregate (#626)

JAVA-3909
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/941dffeab499b6879b868605afffd98440257bb4

Comment by Githook User [ 06/Jan/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add Javadoc indicating which server version supports explain

JAVA-3909
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/277585c99e2ae3b8a96745074ba3f906610f499f

Comment by Githook User [ 06/Jan/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Fix broken explain tests

JAVA-3909
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/785d221821175abe927c666afd1a5acc074f9922

Comment by Githook User [ 06/Jan/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Support explain for aggregate operations (#623)

Support explain for aggregate using the explain command,
which started supporting explaining aggregate commands
in MongoDB 3.6.

JAVA-3909
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/c814e941d2aa42a084b7b2ac4797e2cb32863b57

Comment by Githook User [ 05/Jan/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Fix explain tests on older server versions

JAVA-3909
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/bf685dab270fcf1af26a51e05bbd64690c06abe3

Comment by Githook User [ 05/Jan/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Remove extra whitespace

JAVA-3909
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/68e05dc8660b853eb16ee3edeefcab7c234b5925

Comment by Githook User [ 05/Jan/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Support explain for find operations (#620)

Support is only for server versions 3.2+

JAVA-3909
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/e12c8e25f7206ea5416f1416e04c5a153a894f3b

Generated at Thu Feb 08 09:00:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.