2

The MongoDB documentation states that it is not recommended to use its stored functions feature. This question goes through some of the reasons, but they all seem to boil down to "eval is evil".

Are there specific reasons why server-side functions should not be used in a MapReduce query?

Community
  • 1
  • 1
Ryan Kennedy
  • 3,275
  • 4
  • 30
  • 47

1 Answers1

0

The system.js functions are available to Map Reduce jobs by default ( https://jira.mongodb.org/browse/SERVER-8632 notes a slight glitch to that in 2.4.0rc ).

They are not actually evaled within the native V8/Spidermonkey evironment so tehcnically that part of them is also gone.

So no, there is no real problems, they will run as though native within that Map Reduce and should run just as fast and "good" as any other javascript you write. In fact the system.js collection is more designed to house code for map reduce jobs, it is later uses that sees it used as a hack for "stored procedures".

Sammaye
  • 43,242
  • 7
  • 104
  • 146