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

Clarify how distinct command uses indexes

      Link to text
      http://docs.mongodb.org/manual/reference/command/distinct/

      The following text should include additional clarification so that the users are aware of how it works starting from version 2.6

      When possible, the distinct command uses an index to find documents and return values.

      Please replace it with something like the following in order to reflect how an index may be chosen chosen.

      When convenient to use covered indexes, the db.collection.distinct() method will use an index to find the documents in the query as well as to return the results. A covered will only be used when the index is prefixed by the field in the distinct method. Although there are some cases where a compound index with the distinct field not in the prefix may be a suitable a covered index query, MongoDB cannot reliably determine suitability, so will instead use the underlying documents. In earlier versions, MongoDB would attempt to use any index containing the distinct field.

            Assignee:
            jason.price@mongodb.com Jason Price
            Reporter:
            sherry.ger@10gen.com Sherry Ger
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              9 years, 11 weeks, 6 days ago