Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-3722

Compound index using array indexes doesn't return query results

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Operating System:
      ALL

      Description

      This is definitely an edge case, but probably should work (referenced here: http://groups.google.com/group/mongodb-user/browse_thread/thread/32511a51caad9085). Here's how to reproduce:

      > db.a.save({a: {spec: [{ info: [

      {key: "author", value: "poe"}

      ]} ]}})
      > db.a.find()
      { "_id" : ObjectId("4e5d23ba339dc0b7074165f6"), "a" : { "spec" : [ { "info" : [

      { "key" : "author", "value" : "poe" }

      ] } ] } }

      > db.a.find(

      {"a.spec.0.info.0.key": "author", "a.spec.0.info.0.value": "poe"}

      )
      { "_id" : ObjectId("4e5d23ba339dc0b7074165f6"), "a" : { "spec" : [ { "info" : [

      { "key" : "author", "value" : "poe" }

      ] } ] } }

      So far so good. Now add an index:
      > db.a.ensureIndex(

      {"a.spec.0.info.0.key": 1, "a.spec.0.info.0.value": 1}

      )

      > db.a.find(

      {"a.spec.0.info.0.key": "author", "a.spec.0.info.0.value": "poe"}

      )
      Returns nothing!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              kbanker Kyle Banker
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: