[SERVER-12462] $geoWithin query doesn't return a point on the pole with 2dsphere index Created: 23/Jan/14  Updated: 23/Jul/15  Resolved: 23/Jul/15

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

Type: Bug Priority: Major - P3
Reporter: Andrew Emil (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File server12462.js    
Issue Links:
Duplicate
duplicates SERVER-13599 $geoIntersects does not return polygo... Backlog
Related
Operating System: ALL
Participants:

 Description   

Doing a $geoWithin query on a point at the pole returns results in 2.5.5-pre, but not if a 2dsphere index is raised.

2.5.5-pre:

> db.repro.insert("loc" : [ 25, 90 ])
SingleWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 1,
        "nUpserted" : 0,
        "nUpdated" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})
> db.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
{ "_id" : 0, "loc" : { "type" : "Point", "coordinates" : [ 25, 90 ] } }
>
> db.repro.ensureIndex({loc:"2dsphere"})
> db.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
> db.repro.dropIndexes()
> db.repro.ensureIndex({loc:"2d"})
> db.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
{ "_id" : 0, "loc" : { "type" : "Point", "coordinates" : [ 25, 90 ] } }
> db.runCommand({"buildinfo":1}).gitVersion
f65a0b814b8c77e3fbe90bca0c061c9b77f6acdb

Separately, in 2.4.9, the document is not found at all:

> mydb.repro.insert(x)
> mydb.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
>


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