[JAVA-2105] "$explain" in FindOptions.modifiers ignored when connected to 3.2 server Created: 04/Feb/16  Updated: 16/Feb/16  Resolved: 09/Feb/16

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: 3.2.0
Fix Version/s: 3.2.2

Type: Bug Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-2104 Add explain() capability for new Java... Closed

 Description   

When connected to a server whose version is <= 3.0, a $explain key added to FindOptions.modifiers will be included in the OP_QUERY document. But with the introduction of the find command in server 3.2, a $explain modifier must be converted into an explain command instead, as the find command does not support explain.

So this code:

MongoCollection<Document> collection = ...
collection.find().modifiers(new Document("$explain", true)).first()

should return the query plan, but when connected to a 3.2 server, it does not. It will instead return the first document from a normal cursor on the collection.



 Comments   
Comment by Jeffrey Yemin [ 16/Feb/16 ]

Closed for 3.2.2 release

Comment by Githook User [ 09/Feb/16 ]

Author:

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

Message: JAVA-2105: When $explain : true is in find operation modifiers, use explain command instead of find command when server version >= 3.2
Branch: 3.2.x
https://github.com/mongodb/mongo-java-driver/commit/858498273dc44828868f7f09904fb9b769d0683a

Comment by Githook User [ 08/Feb/16 ]

Author:

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

Message: JAVA-2105: When $explain : true is in find operation modifiers, use explain command instead of find command when server version >= 3.2
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/d61e8514710381de2e7f524074cbc08df23af35e

Generated at Thu Feb 08 08:56:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.