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

MapReduce scope variables do not get cleaned up

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: MapReduce
    • Labels:
      None
    • ALL
    • Hide

      //some random data
      db.test.insert(

      {blabla:123}

      )

      //error
      db.test.mapReduce(function()

      {foo == true}, function(){}, {out:{inline:1}})

      //success
      db.test.mapReduce(function(){foo == true}

      , function(){}, {out:

      {inline:1}

      , scope:{foo:true}})

      //succeeds
      db.test.mapReduce(function()

      {foo == true}

      , function(){}, {out:{inline:1}})

      Show
      //some random data db.test.insert( {blabla:123} ) //error db.test.mapReduce(function() {foo == true}, function(){}, {out:{inline:1}}) //success db.test.mapReduce(function(){foo == true} , function(){}, {out: {inline:1} , scope:{foo:true}}) //succeeds db.test.mapReduce(function() {foo == true} , function(){}, {out:{inline:1}})

      It looks like any variables that are passed as part of the MapReduce 'scope' argument will linger around forever on the server, potentially affecting any future MapReduce commands. Is this intended behavior?

      I was under the impression that MapReduce functions were implemented as closures around the scoped environment, which would naturally clean the variables once they go out of scope.

            Assignee:
            Unassigned Unassigned
            Reporter:
            Jeroenooms Jeroen Ooms [X]
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: