Scala
  1. Scala
  2. SCALA-43

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

    Details

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

      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 ?

        Activity

        Hide
        Kamenskiy Valeriy
        added a comment - - edited

        Hi,

        It doesn't work for me too.

        Show
        Kamenskiy Valeriy
        added a comment - - edited Hi, It doesn't work for me too.
        Hide
        auto
        added a comment -

        Author:

        {u'date': u'2013-05-15T15:57:36Z', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

        Message: Fixed support for jsScope (SCALA-43) (#44)
        Branch: master
        https://github.com/mongodb/casbah/commit/d955eb183caceefa07f0302fbdb812457fe63d31

        Show
        auto
        added a comment - Author: {u'date': u'2013-05-15T15:57:36Z', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'} Message: Fixed support for jsScope ( SCALA-43 ) (#44) Branch: master https://github.com/mongodb/casbah/commit/d955eb183caceefa07f0302fbdb812457fe63d31

          People

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

            Dates

            • Created:
              Updated:
              Resolved:
              Days since reply:
              48 weeks, 2 days ago
              Date of 1st Reply: