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

Map Reduce in Mongosh won't transmit scope

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • No version
    • Embedded Shell
    • None
    • Not Needed

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: