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

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 2.8, 3.0
    • Affects Version/s: 2.1.1
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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")
      

              Assignee:
              Bernie Hackett
              Reporter:
              Uladzimir Mihura (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: