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

Allow multi ringed shapes to be used for $geoWithin.

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Geo
    • Query Integration

      Add a way to specify minDistance to $geoWithin allowing querying for being in a ring shape, analogous to what $near/$nearSphere allowed with $minDistance and $maxDistance options.

      The only current workaround if $geoNear aggregation stage cannot be used is this query:

      {$and:[
        {$nor:[
           {center:{
              $geoWithin:{$centerSphere:[ [ <x>,<y> ],<minDistance-in-radians>]}
           }}
        ]}, 
        {center:{
              $geoWithin:{$centerSphere:[ [ <x>, <y> ],<maxDistance-in-radians>]}
        }}
      ]} 

       

      Original description:

      With the deprecation of count in favor of countDocuments it is no longer possible to use the $near operator with the new API.

      Unfortunately the alternative $geoWithin $center only supports radius whereas $near allowed having a ring specified by $minDistance & $maxDistance.

      There's no workaround for this, $geoWithin seems to only supports single ringed structures, so this might be more a server issue than a driver one.

            Assignee:
            backlog-query-integration [DO NOT USE] Backlog - Query Integration
            Reporter:
            cstrobl Christoph Strobl
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: