-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 1.8.0
-
Component/s: JavaScript, MapReduce, Sharding
-
None
-
ALL
-
None
-
0
-
None
-
None
-
None
-
None
-
None
-
None
When depending on JS stored on the server side the functionality fails if a collection is a sharded.
Server-side JS:
http://www.mongodb.org/display/DOCS/Server-side+Code+Execution#Server-sideCodeExecution-Storingfunctionsserverside
Looking at the Sharding Limits, this is not clearly stated:
http://www.mongodb.org/display/DOCS/Sharding+Limits
There's a mention that db.eval() fails, but no clarification that this includes server-side JS. Additionally, the docs state that $where works, but if the $where is dependent on the server-side JS, then it too will fail.
In theory, this can be worked around by adding the same function to each shard individually, but this is bad practice.
======
Options:
1. Disallow server-side JS in sharded scenarios
2. Add this functionality so that server-side JS is "replicated" across shards
======
In case #1, we get an instance where mongoS behaves differently than mongoD
In case #2, we get consistent behavior between mongoS and mongoD, but we have to implement special behavior for a particular collection (mind you it is a system collection).