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

Allow $expr or $$field in the $geoNear stage

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Query Optimization

      When trying to use a $lookup with pipeline and a $geoNear stage, there is no way to pass an argument in the let field into the $geoNear stage.

      e.g.

      { 
                  "$lookup" : {
                      "from" : "regions", 
                      "let" : {
                          "point" : "$location"
                      }, 
                      "pipeline" : [
                          {
                              "$geoNear" : {
                                  "spherical" : true, 
                                  "maxDistance" : 10000.0, 
                                  "distanceField" : "distance", 
                                  "uniqueDocs" : true, 
                                  "near" : "$$point"
                              }
                          }
                      ], 
                      "as" : "regions"
                  }
      }
      

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            travis@bryx.com Travis Brown
            Votes:
            24 Vote for this issue
            Watchers:
            36 Start watching this issue

              Created:
              Updated:
              Resolved: