-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.6.0-rc0
-
Component/s: JavaScript, Querying
-
Query Execution
-
ALL
-
-
None
-
None
-
None
-
None
-
None
-
None
-
None
A $where query in v2.6rc0 always creates a V8Scope, even if other operators do not match. v2.4.9 doesn't create a scope unless other operators match.
For some queries, this results in v2.6rc0 running slower by two orders of magnitude; e.g.:
{
"_id" : ObjectId("530f6bad7e6c53525919dfa9"),
"deltaRatio" : "92.31",
"deltaUs" : 11094.5,
"v249Avg" : "121.50",
"v249Results" : [
121,
123,
122,
120,
121,
122
],
"rc0Avg" : "11216.00",
"rc0Results" : [
11398,
11187,
11164,
11220,
11181,
11146
],
"testId" : "GeneratedTests::GeneratedQuery761[Compound2]",
"qry" : "{ query: { arrayField: null, d: { $mod: [ 314159265, 314159215 ] }, $where: \"function myFunction() { return String(this.a || this.b || this.c || this.d).length > 9; }\", _id: //d?[A-E]*// }, orderby: { d: 1 } }",
"proj" : "{ b: 1, a: 1 }",
"idx" : "Compound2",
"rc0Count" : 0,
"v249Count" : 0,
"countsMatch" : true
}