[SERVER-31624] Upgraded 3.2 to 3.4, $geoNear aggregate fails with featureCompatibilityVersion 3.4 collation error Created: 18/Oct/17  Updated: 30/Oct/23  Resolved: 31/Oct/17

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Geo
Affects Version/s: 3.4.9
Fix Version/s: 3.4.11

Type: Bug Priority: Major - P3
Reporter: Aaron Queen Assignee: Janna Golden
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

2dsphere index:

{
   "v" : 1,
   "key" : {
      "loc" : "2dsphere"
   },
   "name" : "loc_2dsphere",
   "2dsphereIndexVersion" : 2,
    "ns" : "client_test.test"
}

Find succeeds, no error:

> db.test.find({ loc : { $nearSphere : { $geometry : { type : "Point", coordinates : [ 1.23, 1.23 ] } } } });

Aggregate fails:

> db.test.aggregate([{ $geoNear : { near : { type : "Point", coordinates : [1.23, 1.23] }, distanceField : "distance", spherical : true }}]);
 
assert: command failed: {
        "ok" : 0,
        "errmsg" : "geoNear command failed: { ok: 0.0, errmsg: \"The featureCompatibilityVersion must be 3.4 to use collation. See http://dochub.mongodb.org/core/3.4-feature-compatibility.\", code: 72, codeName: \"InvalidOptions\" }",
        "code" : 16604,
        "codeName" : "Location16604"
} : aggregate failed
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:16:14
assert.commandWorked@src/mongo/shell/assert.js:370:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1319:5
@(shell):1:1

Sprint: Query 2017-11-13
Participants:

 Description   

We have upgraded MongoDB 3.2 to 3.4, but have not yet setFeatureCompatibilityVersion to 3.4

When trying to use aggregate $geoNear, it fails with an error. Using find $nearSphere succeeds with no error.

If I set setFeatureCompatibilityVersion to "3.4", the aggregate succeeds, but it shouldn't have failed when set to "3.2" as I wasn't trying to do anything with collation at all, and it is still a v:1 index. Interestingly, if I go up to setFeatureCompatibilityVersion "3.4", create a v:2 / 2dsphereIndexVersion:3 index, then setFeatureCompatibilityVersion back to "3.2", it's the same exact error, so I don't actually think it has anything to do with the index v:1 vs v:2 at all, just some bug in the aggregation framework perhaps?



 Comments   
Comment by Githook User [ 31/Oct/17 ]

Author:

{'email': 'golden.janna@gmail.com', 'name': 'jannaerin', 'username': 'jannaerin'}

Message: SERVER-31624 fix featureCompatibilityVersion collation error in
Branch: v3.4
https://github.com/mongodb/mongo/commit/a9b2b980ad34b62162340dfc1fb949929aaaae5e

Comment by Mark Agarunov [ 19/Oct/17 ]

Hello aqueen,

Thank you for the report. Using the provided examples, I've reproduced the behavior and can confirm this is a bug. This looks to be due to the collation being set unconditionally in the aggregation pipeline. I've set the fixVersion on this ticket to 'Needs Triage' to be scheduled against our currently planned work. Updates will be posted on this ticket as they happen.

Thanks,
Mark

Generated at Thu Feb 08 04:27:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.