[SERVER-3722] Compound index using array indexes doesn't return query results Created: 30/Aug/11  Updated: 29/Feb/12  Resolved: 30/Aug/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kyle Banker Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-2902 Index keys are not generated for nume... Closed
Operating System: ALL
Participants:

 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!



 Comments   
Comment by Aaron Staple [ 30/Aug/11 ]

This was implemented in 1.9 with SERVER-2902. I tested the provided code and it works in 2.0rc trunk.

Generated at Thu Feb 08 03:03:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.