[SERVER-8457] Compound 2d sphere indexes in 2.4 don't support array fields? Created: 06/Feb/13  Updated: 11/Jul/16  Resolved: 12/Feb/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.4.0-rc0
Fix Version/s: 2.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Fredrik Björk Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

I tried inserting the following document:

{
"_id" : ObjectId("510c1f0a9dcaa36340e0c983"),
"location" :

{ "type" : "Point", "coordinates" : [ -122, 37 ] }

,
"friend_ids" : [
123,
456
]
}

Added the following index:
db.updates.ensureIndex(

{ friend_ids: 1, location: '2dsphere' }

)

But when I query for the following, nothing is returned:
db.updates.find({ friend_ids: 123, location: {$near:

{ type: "Point", coordinates: [-122, 37]}

}})

It works for non-array fields. Is this by design or a bug?



 Comments   
Comment by hari.khalsa@10gen.com [ 12/Feb/13 ]

I've submitted a patch to make the array indexing behavior more consistent with the "regular" array indexing behavior. This may cause the index size to increase, but at least the behavior is consistent.

Comment by auto [ 12/Feb/13 ]

Author:

{u'date': u'2013-02-07T19:18:17Z', u'name': u'Hari Khalsa', u'email': u'hkhalsa@10gen.com'}

Message: SERVER-8457 explode arrays in 2dsphere
Branch: master
https://github.com/mongodb/mongo/commit/53f0dccda36bf56bdf55ee2c8c5843f0f78f50a1

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