A query that used to not error now will result in the error. From what I can see this is correct behavior, but it should be documented/noted.
On 2.4.9:
> db.myCollection.find( {x: {$elemMatch: { $where: "this.credits == this.debits" }}} );
>
On 2.5.5-pre
> db.runCommand({"buildinfo": 1})
{
"version" : "2.5.5-pre-",
"gitVersion" : "f65a0b814b8c77e3fbe90bca0c061c9b77f6acdb",
"OpenSSLVersion" : "",
"sysInfo" : "Darwin Andrew-Emil-MacBook-Pro.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -Wl,-bind_at_load -mmacosx-version-min=10.6",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -O3 -Wno-unused-function -Wno-deprecated-declarations -mmacosx-version-min=10.6",
"allocator" : "tcmalloc",
"versionArray" : [
2,
5,
5,
-100
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
> db.myCollection.find( {x: {$elemMatch: { $where: "this.credits == this.debits" }}} );
error: {
"$err" : "Can't canonicalize query: BadValue unknown operator: $where",
"code" : 17287
}
- is duplicated by
-
SERVER-14010 Use of $where within $elemMatch
-
- Closed
-
- related to
-
SERVER-11731 $where inside of projection $elemMatch causes segmentation fault
-
- Closed
-
-
SERVER-13503 The $where operator should not be allowed under $elemMatch
-
- Closed
-