Uploaded image for project: 'CASBAH'
  1. CASBAH
  2. CASBAH-33

JS variables passed through the jsScope object in map reduce are not available

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.6.1
    • Component/s: None
    • Labels:
    • Environment:
      Ubuntu GNU/Linux, MongoDB 1.8
    • # Replies:
      2
    • Last comment by Customer:
      true

      Description

      I try to put variables in the global scope with the jsScope param, but I can't access them from the map and reduce functions.

      In a console with the imports done :
      > val collection = MongoConnection()("spam")("eggs")
      ...
      > val map = """
      function m() {
      emit(this._id,

      {spam: foo}

      );
      }
      """
      > val reduce = """
      function r(k, v) {
      return(k);
      }
      """
      > val jsScope = """

      { foo: "bar" }

      """
      > val result = collection.mapReduce(map, reduce, MapReduceInlineOutput, jsScope=Some(jsScope))

      {MapReduceError 'None'}

      (it works when I remove the reference to "foo" in the map function).
      In the Mongo Shell it works fine

      I was not able to test on OSs other than GNU/Linux

      Am I doing something wrong ?

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                4 years, 15 weeks ago
                Date of 1st Reply: