Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-314

Using index by its name through helper cursor.hint()

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.8, 3.0
    • Component/s: None
    • Labels:
    • Sprint:
      Python Sprint 8

      Description

      Now for using index we can use helper cursor.hint(index). index should be an index as passed to create_index() (e.g. [('field', ASCENDING)]):

      collection.ensure_index(name="indexname", [("length", pymongo.ASCENDING)])
      cursor.hint([("length", pymongo.ASCENDING)])

      But it will be more flexible to get an opportunity to write

      collection.ensure_index(name="indexname", [("length", pymongo.ASCENDING)])
      cursor.hint("indexname")

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: