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

$geoWithin shouldn't accept multiple shapes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL

      The $geoWithin parser accepts multiple shapes (things like $center, $centerSphere, $geometry), but it ignores all but the last one.

      // Only $center is used:
      > db.c.find({loc: {$geoWithin: {$centerSphere: [[0, 80], 1], $center: [[0, 0], 5]}}})
      { "_id" : ObjectId("61dca5b1ef27df133baf5abd"), "loc" : [ 0, 0 ] }
      
      // Only $centerSphere is used:
      > db.c.find({loc: {$geoWithin: {$center: [[0, 0], 5], $centerSphere: [[0, 80], 1]}}})
      

      This seems like a mistake. (If we really accepted multiple shapes, a more useful behavior would be union or intersection.) And the docs examples all use a single shape: https://docs.mongodb.com/manual/reference/operator/query/geoWithin/

      We should consider fixing $_internalBucketGeoWithin in the same way.

            Assignee:
            maddie.zechar@mongodb.com Maddie Zechar
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: