Operational Defect Database

BugZero found this defect 2495 days ago.

MongoDB | 377248

[SERVER-28951] Regex returns partial matches

Last update date:

10/27/2023

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

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

Top User Comments

thomas.schubert commented on Tue, 25 Apr 2017 15:41:11 +0000: Hi greenlaw110, That's right, I've updated the ticket summary to clarify this behavior. Kind regards, Thomas greenlaw110 commented on Tue, 25 Apr 2017 06:04:34 +0000: Alright so according to http://stackoverflow.com/questions/43602310/mongdodb-regex-matching-failed-when-presented/43602744#43602744 it is due to partial matching, not a bug

Additional Resources / Links

Share:

BugZero Risk Score

Coming soon

Status

Closed

Have you been affected by this bug?

cost-cta-background

Do you know how much operational outages are costing you?

Understand the cost to your business and how BugZero can help you reduce those costs.

Discussion

Login to read and write comments.

Have you ever...

had your data corrupted from a

VMware

bug?

Search:

...