-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: mongodb-2.6
-
Component/s: manual
-
Environment:> db.serverBuildInfo()
{
"version" : "2.5.3-pre-",
"gitVersion" : "1ea7e56cb2b8653d4b0453f04728033df34be9e1",
"OpenSSLVersion" : "",
"sysInfo" : "Darwin vero 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -Wl,-bind_at_load",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wno-unknown-pragmas -Winvalid-pch -pipe -O3 -Wno-unused-function -Wno-deprecated-declarations -mmacosx-version-min=10.6",
"allocator" : "tcmalloc",
"versionArray" : [
2,
5,
3,
-100
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
> db.serverBuildInfo() { "version" : "2.5.3-pre-", "gitVersion" : "1ea7e56cb2b8653d4b0453f04728033df34be9e1", "OpenSSLVersion" : "", "sysInfo" : "Darwin vero 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49", "loaderFlags" : "-fPIC -pthread -Wl,-bind_at_load", "compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wno-unknown-pragmas -Winvalid-pch -pipe -O3 -Wno-unused-function -Wno-deprecated-declarations -mmacosx-version-min=10.6", "allocator" : "tcmalloc", "versionArray" : [ 2, 5, 3, -100 ], "javascriptEngine" : "V8", "bits" : 64, "debug" : false, "maxBsonObjectSize" : 16777216, "ok" : 1 }
Problem:
For the given query
db.q.find( {"s.a": {$not: {$regex:"0"}}})
2.4.x and 2.5.x give different error codes.
Reproduce:
2.4.5
> db.q.drop(); true > db.q.insert(s: {a: "foo"}}) > db.q.insert({s: {a: "foo"}}) > db.q.find( {"s.a": {$not: {$regex:"0"}}}) error: { "$err" : "can't use $not with $regex, use BSON regex type instead", "code" : 13032 }
2.5.3-pre
> db.q.drop(); true > db.q.insert({s: {a: "foo"}}) > db.q.find( {"s.a": {$not: {$regex:"0"}}}) error: { "$err" : "bad query: BadValue $not cannot have a regex", "code" : 16810 }