-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: None
-
Component/s: None
-
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:
The behaviour of $mod operator has changed from 2.4.x to 2.5.x.
Impact:
Backward breaking change
Reproduce:
2.4.5
db.q.drop(); db.q.insert({ni: {d:20}}) db.q.find({"ni.d": {$mod: [5]}}) { "_id" : ObjectId("525dcfbc9acd59e2720c38aa"), "ni" : { "d" : 20 } } db.q.find({"ni.d": {$mod: [5,0]}}) { "_id" : ObjectId("525dcfbc9acd59e2720c38aa"), "ni" : { "d" : 20 } } db.q.find({"ni.d": {$mod: [5,0,1]}}) { "_id" : ObjectId("525dcfbc9acd59e2720c38aa"), "ni" : { "d" : 20 } }
2.5.3-pre
db.q.drop(); db.q.insert({ni: {d:20}}) db.q.find({"ni.d": {$mod: [5]}}) error: { "$err" : "bad query: BadValue malformed mod, not enough elements", "code" : 16810 } db.q.find({"ni.d": {$mod: [5,0]}}) { "_id" : ObjectId("525dd042e92d3da1f88a3311"), "ni" : { "d" : 20 } } db.q.find({"ni.d": {$mod: [5,0,1]}}) error: { "$err" : "bad query: BadValue malformed mod, too many elements", "code" : 16810 }
)