[DOCS-2138] $not + $regex gives different error code between 2.4. and 2.5 Created: 18/Oct/13  Updated: 07/Nov/13  Resolved: 22/Oct/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: mongodb-2.6
Fix Version/s: mongodb-2.6

Type: Bug Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: 26qa, nqf
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
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
}


Issue Links:
Related
Participants:
Days since reply: 10 years, 17 weeks, 3 days ago

 Description   

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 }



 Comments   
Comment by Daniel Pasette (Inactive) [ 21/Oct/13 ]

This change fell out of the matcher refactor.

Comment by Alvin Richards (Inactive) [ 18/Oct/13 ]

Additional changes

2.4.5

> db.q.find( {"s.a": {$not: {}}})
error: { "$err" : "$not cannot be empty", "code" : 13030 }

2.5.3-pre

> db.q.find( {"s.a": {$not: {}}})
error: { "$err" : "bad query: BadValue $not cannot be empty", "code" : 16810 }

Generated at Thu Feb 08 07:42:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.