Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-10779

please make it easier to understand whether a query is index only

      AFAIK, back in the day db.find().explain() had an "indexOnly" attribute. That has been removed and now I am confused by the text for "Covered Queries" in https://docs.mongodb.com/manual/reference/explain-results/

      An example would help.

      Below is explain output for a query that it isn't index-only but that took me too long to figure out.

      {
              "queryPlanner" : {
                      "plannerVersion" : 1,
                      "namespace" : "ib.pi1",
                      "indexFilterSet" : false,
                      "parsedQuery" : {
                              "customerid" : {
                                      "$lt" : 0
                              }
                      },
                      "winningPlan" : {
                              "stage" : "PROJECTION",
                              "transformBy" : {
                                      "_id" : -1,
                                      "price" : 1,
                                      "customerid" : 1
                              },
                              "inputStage" : {
                                      "stage" : "FETCH",
                                      "filter" : {
                                              "customerid" : {
                                                      "$lt" : 0
                                              }
                                      },
                                      "inputStage" : {
                                              "stage" : "IXSCAN",
                                              "keyPattern" : {
                                                      "price" : 1,
                                                      "customerid" : 1
                                              },
                                              "indexName" : "pc",
                                              "isMultiKey" : false,
                                              "multiKeyPaths" : {
                                                      "price" : [ ],
                                                      "customerid" : [ ]
                                              },
                                              "isUnique" : false,
                                              "isSparse" : false,
                                              "isPartial" : false,
                                              "indexVersion" : 2,
                                              "direction" : "forward",
                                              "indexBounds" : {
                                                      "price" : [
                                                              "[MinKey, MaxKey]"
                                                      ],
                                                      "customerid" : [
                                                              "[MinKey, MaxKey]"
                                                      ]
                                              }
                                      }
                              }
                      },
                      "rejectedPlans" : [ ]
              },
              "serverInfo" : {
                      "host" : "nuc1",
                      "port" : 27017,
                      "version" : "3.4.6-1.7",
                      "gitVersion" : "74b930309498503ee1c64d9a2526e45e2da464a2"
              },
              "ok" : 1
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            mdcallag Mark Callaghan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              1 year, 27 weeks, 2 days ago