Error Regex does not match all Mongo Error structures
See original GitHub issueUsing Mongo version 3.2.4 installed on Ubuntu 14.04
It seems as if the errorRegex (index.js#L6) you are using does not match all structures of E11000 duplicate key errors.
For example: https://regex101.com/r/lA2dZ7/1
Error Regex
var errorRegex = /index:\s*.+?\.\$(\S*)\s*dup key:\s*\{(.*?)\}/;
Matching Error Structure
E11000 duplicate key error index: database-name.users.$username_1 dup key: { : "andrew" }
Non-matching Error Structure
E11000 duplicate key error collection: database-name.users index: username_1 dup key: { : "andrew" }
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
regex with mongolite in R - mongodb - Stack Overflow
Trying to do a regex match with the awesome ...
Read more >Improved Error Messages for Schema Validation in MongoDB ...
First, let's look at the new error message. It is a structured message in the BSON format, explaining which part of the document...
Read more >How To Use Schema Validation in MongoDB - DigitalOcean
In MongoDB, the database engine feature that makes it possible to apply constraints on the document structure is called Schema Validation ...
Read more >MongoDB NOT operator ( $not ) - GeeksforGeeks
This operator is used to perform logical NOT operation on the specified operator expressions and select or retrieve only those documents that do...
Read more >4. Querying - MongoDB: The Definitive Guide, 2nd Edition [Book]
The find method is used to perform queries in MongoDB. Querying returns a subset of documents in a collection, from no documents at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The updated regex appears to match all scenarios: https://regex101.com/r/lA2dZ7/2
Correct @Fonger?
Will do!