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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.1.1
    • 2.8, 3.0
    • None

    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

              bernie@mongodb.com Bernie Hackett
              uladzimir_mihura@epam.com Uladzimir Mihura
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: