[SERVER-2391] Cannot use compound of 2d and date value index Created: 21/Jan/11  Updated: 24/Jan/11  Resolved: 24/Jan/11

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

Type: Bug Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: Greg Studer
Resolution: Duplicate Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-2381 Cannot use compound of 2d and multike... Closed
Operating System: ALL
Participants:

 Description   

Problem:
Can't seen to combine $within with additional predicate

Reproduce:

> db.testcol.find()
{ "_id" : "1", "title" : "Doc1", "loc" :

{ "lat" : 0, "lng" : 1 }

, "occurences" : [

{ "instanceId" : 1, "startDate" : ISODate("2001-01-23T03:00:00Z") }

,

{ "instanceId" : 2, "startDate" : ISODate("2011-01-30T03:00:00Z") }

] }
{ "_id" : "2", "title" : "Doc2", "loc" :

{ "lat" : 0, "lng" : 1 }

, "occurences" : [

{ "instanceId" : 1, "startDate" : ISODate("2011-01-24T03:00:00Z") }

,

{ "instanceId" : 2, "startDate" : ISODate("2011-01-25T03:00:00Z") }

] }

This works

> db.testcol.find({ "loc": { "$within":
...

{ "$box": [ [ 0, 0 ], [ 1, 1 ] ] }

}
... })
{ "_id" : "1", "title" : "Doc1", "loc" :

{ "lat" : 0, "lng" : 1 }

, "occurences" : [

{ "instanceId" : 1, "startDate" : ISODate("2001-01-23T03:00:00Z") }

,

{ "instanceId" : 2, "startDate" : ISODate("2011-01-30T03:00:00Z") }

] }
{ "_id" : "2", "title" : "Doc2", "loc" :

{ "lat" : 0, "lng" : 1 }

, "occurences" : [

{ "instanceId" : 1, "startDate" : ISODate("2011-01-24T03:00:00Z") }

,

{ "instanceId" : 2, "startDate" : ISODate("2011-01-25T03:00:00Z") }

] }

However, restricting by occurences.startDate returns no documents

> db.testcol.find({ "loc": { "$within":
...

{ "$box": [ [ 0, 0 ], [ 1, 1 ] ] }

},
... "occurences.startDate":
... { "$gte": new Date(2011,0,23)}})



 Comments   
Comment by Greg Studer [ 24/Jan/11 ]

Also geoindex and multi-key issue.

Comment by Greg Studer [ 24/Jan/11 ]

Same issue as http://jira.mongodb.org/browse/SERVER-2381, not date-related. Should be fixed by the same improvement.

Generated at Thu Feb 08 02:59:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.