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

How to use 'hint' for a compound index in pymongo

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      pymongo 2.8

      I am trying to use the hint command for my queries. Unfortuately I do not know the proper format for using 'hint' on a compound index in pymongo.
      I have gotten it to work successfully on the mongodriver using robomongo:
      command using robomongo:
      Hint using index name: db.seqs.find({'DATA.CDR3.AA':{$exists:true},'EXP_ID':{$in:[ObjectId("552c261b9eb6363a487b62ca")]).hint('EXP_ID_1_SEQ_ID_1_ANALYSIS_NAME_1',

      {'DATA.CDR3.AA':1}

      )

      Hint using index: db.seqs.find({'DATA.CDR3.AA':{$exists:true},'EXP_ID':{$in:[ObjectId("552c261b9eb6363a487b62ca")]).hint(

      {'EXP_ID':1,'SEQ_ID':1,'ANALYSIS_NAME':1}

      ,

      {'DATA.CDR3.AA':1}

      )

      What would be the equivalent of these commands using pymongo 2.8 and further??

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            cchrysos1@gmail.com constantine
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: