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

fix $geoNear and $text within $lookup sub-pipeline

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 4.1.8
    • Affects Version/s: 3.6.9, 4.0.5, 4.1.7
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Query 2019-01-14, Query 2019-01-28

      When a $geoNear stage is part of a $lookup stage's pipeline, this aggregation will fail with error code 50860. Attached is a script which can be used to reproduce this error by running it from the jstests/aggregation/sources/lookup directory: 

       buildscripts/resmoke.py --suites='aggregation' jstests/aggregation/sources/lookup/lookup_subpipeline_geonear.js 

      Part of fixing this test will include making sure this works in the sharded case, and adding test coverage for $geoNear within a $lookup subpipeline. This will include testing that this works with $geoNear using a $$ variable within the query option. For example:

        const pipeline = [
              {
                $lookup: {
                    let : {var1: "$x"},
                    pipeline: [
                        {$geoNear: {near: [0, 0], distanceField: "distance", spherical: true, query: {_id:"$$var1"},}}, 
                    ],
                    from: "from",
                    as: "c",
                }
              },
          ];
      

       This does not affect 4.0.

            Assignee:
            brigitte.lamarche@mongodb.com Brigitte Lamarche (Inactive)
            Reporter:
            brigitte.lamarche@mongodb.com Brigitte Lamarche (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: