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

Can't create index with multiple same keys

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4
    • Component/s: None

      Using PyMongo I'm not able to create index with 2 same keys in different possitions, like this:

      collection.create_index([
          ("int_key", pymongo.ASCENDING),
          ("exact_match_str", pymongo.ASCENDING),
          ("int_key", pymongo.ASCENDING)
      ])
      

      It generates right name of the index:
      int_key_1_exact_match_str_1_int_key_1

      But, in mongo I see only this index:

      {
          "v": 1,
          "key": {
            "int_key": 1,
            "exact_match_str": 1
          },
          "name": "int_key_1_exact_match_str_1_int_key_1",
          "ns": "batman_sync.tracks"
        }
      

      But, If I create index with this json inside ROBOMONGO:

      {
          int_key : 1,
          exact_match_str : 1,
          int_key : 1
      }
      

      I can see this index inside ROBOMONGO, and query which related to this kinda index performs really well!

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            libbkmz Ilya
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: