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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.4.9
    • Fix Version/s: 3.4.11
    • Component/s: Aggregation Framework, Geo
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      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
    • Sprint:
      Query 2017-11-13

      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?

        Attachments

          Activity

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: