Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-960

Map Reduce in Mongosh won't transmit scope

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: Embedded Shell
    • None
    • Not Needed

      Problem Statement/Rationale

      The Mongo standard client will work seamlessly, however, the mongosh client will simply not transmit the scope to the server.

      Steps to Reproduce

      db.orders.mapReduce(
          monthlyMapFunction,
          reduceFunction,
          {
            query: {
              createdAt: {
                $gt: startDate,
                $lte: endDate
              }
            },
            scope: {
              skus
            },
            out: { reduce: 'monthlyOrders' }
          }
        );
      
      

      Expected Results

      the `skus` variable should be available in both the map and the reduce functions (and, when necessary, in the finalize function).

      Actual Results

      The `skus` variable is 'null' or undefined.

      Additional Notes

      It works perfectly fine in the good old mongo client

            Assignee:
            Unassigned Unassigned
            Reporter:
            valentin@zalter.com Valentin Popescu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: