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

Allow multi ringed shapes to be used for $geoWithin.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Geo
    • None
    • Query Integration

    Description

      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.

      Attachments

        Activity

          People

            backlog-query-integration Backlog - Query Integration
            cstrobl Christoph Strobl
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

            Dates

              Created:
              Updated: