-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
ALL
-
Original Summary
Regex matching failed when ":" is presented
Original Description
Here is my mongodb shell session
> db.foo.save({path: 'a:b'}) WriteResult({ "nInserted" : 1 }) > db.foo.findOne() { "_id" : ObjectId("58fedc47622e89329d123ee8"), "path" : "a:b" } > db.foo.save({path: 'a:b:c'}) WriteResult({ "nInserted" : 1 }) > db.foo.find({path: /a:[^:]+/}) { "_id" : ObjectId("58fedc47622e89329d123ee8"), "path" : "a:b" } { "_id" : ObjectId("58fedc57622e89329d123ee9"), "path" : "a:b:c" } > db.foo.find({path: /a:[a-z]+/}) { "_id" : ObjectId("58fedc47622e89329d123ee8"), "path" : "a:b" } { "_id" : ObjectId("58fedc57622e89329d123ee9"), "path" : "a:b:c" }
Clearly the regex /a:[^:]/ and /a:[a-z]/ shall not match string 'a:b:c', but looks like mongo failed on this regex