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

Allow multi ringed shapes to be used for $geoWithin.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Geo
    • Labels:
      None

      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

            Assignee:
            backlog-query-optimization Backlog - Query Optimization
            Reporter:
            cstrobl Christoph Strobl
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Dates

              Created:
              Updated: