-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: JavaScript
-
None
-
Environment:Ruby 1.8 / Ruby 1.9
With $where you can do something like:
posts.find($where => Code.new("i < 3",
{i: 2}))
and there will be scope created with i variable set to 2 fror "i < 3" part.
However, this doesn't work with map-reduce functions.
map = "function() { emit(this._id,
{foo: 'bar'); }"
reduce = Code.new(
"function(key, values)
",
{x: 1})
posts.map_reduce(map, reduce)
This throws an error like:
map-reduce failed: assertion: invoke failed: JS Error: ReferenceError: x is not defined nofile_b:3