Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31624

Upgraded 3.2 to 3.4, $geoNear aggregate fails with featureCompatibilityVersion 3.4 collation error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.11
    • Affects Version/s: 3.4.9
    • Component/s: Aggregation Framework, Geo
    • None
    • Fully Compatible
    • ALL
    • Hide

      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
      
      Show
      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
    • Query 2017-11-13

      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?

            Assignee:
            janna.golden@mongodb.com Janna Golden
            Reporter:
            aqueen Aaron Queen
            Votes:
            2 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: