$geoNear aggregation stage should reject unknown arguments

XMLWordPrintableJSON

    • Query Optimization
    • Minor Change
    • QO 2023-06-12, QO 2023-06-26
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The $geoNear stage currently ignores any unfamiliar arguments (see repro steps). Instead, it should check for unfamiliar arguments and fail if any are found.

      The following script demonstrates the problem:

      (function() {
          "use strict";
      
          db.c.drop();
      
          assert.commandWorked(db.c.createIndex({loc: "2dsphere"}));
          assert.writeOK(db.c.insert({loc: [0, 0]}));
      
          // This should fail due to the unknown argument, but instead it succeeds.
          assert.commandFailed(db.runCommand({
              aggregate: "c",
              pipeline: [{
                  $geoNear: {
                      near: {type: "Point", coordinates: [0, 0]},
                      distanceField: "distanceField",
                      spherical: true,
                      blah: "blaarghhh",
                  }
              }]
          }));
      })();
      

            Assignee:
            Naafiyan Ahmed
            Reporter:
            David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: