Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2105

"$explain" in FindOptions.modifiers ignored when connected to 3.2 server

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.2.2
    • Affects Version/s: 3.2.0
    • Component/s: Query Operations
    • None

      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.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: