Comments (11)
Should be fixed in version 3.0.1, thanks for your help. :)
from mongoose-beautiful-unique-validation.
Added breaking test PR #21
from mongoose-beautiful-unique-validation.
Super, thanks! Looks good to me here.
from mongoose-beautiful-unique-validation.
Hi @koppert, using MongoDB v3.2.7 and Mongoose v4.5.1 the tests are passing correctly. Could you provide the piece of code that triggers this error? Thanks for your help. :)
from mongoose-beautiful-unique-validation.
It's when rawValues
has a space in it the regex does not match:
: "ab",
matches
: "a b",
does not match
The regex in question is /\s*:\s*(\S*),/g
My stacktrace is:
rawValues=: "Tag label",
TypeError: Cannot read property '1' of null
at /code/trustroots/node_modules/mongoose-beautiful-unique-validation/index.js:92:55
at Array.forEach (native)
at /code/trustroots/node_modules/mongoose-beautiful-unique-validation/index.js:90:19
at tryCallOne (/code/trustroots/node_modules/promise/lib/core.js:37:12)
at /code/trustroots/node_modules/promise/lib/core.js:123:15
at flush (/code/trustroots/node_modules/asap/raw.js:50:29)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
from mongoose-beautiful-unique-validation.
Added breaking test here #18
from mongoose-beautiful-unique-validation.
... actually that breaks on a different line: https://travis-ci.org/matteodelabre/mongoose-beautiful-unique-validation/jobs/144058001#L623 .. but I think you get the idea
TypeError: Cannot read property '1' of null
at beautify (/home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/index.js:61:24)
at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/index.js:180:21
at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/node_modules/mongoose/lib/model.js:3331:16
at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/node_modules/mongoose/lib/model.js:188:9
at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/node_modules/kareem/index.js:127:16
at doNTCallback0 (node.js:430:9)
at process._tickCallback (node.js:359:13)
from mongoose-beautiful-unique-validation.
Sorry for the lack of feedback. The problem is in space, really.
from mongoose-beautiful-unique-validation.
It's fixed when the keys contain spaces, but not for when the values do. There were two causes of the same error message.
from mongoose-beautiful-unique-validation.
I overlooked that a bit indeed. Thanks for the heads up!
from mongoose-beautiful-unique-validation.
Should be fixed in version 3.0.2. Value parsing is a bit less hacky and uses JSON.parse.
from mongoose-beautiful-unique-validation.
Related Issues (20)
- Unique custom message on nested objects. HOT 1
- Doesn't work with the new Mongoose 5.x RCs HOT 4
- Incorrect regex for compound keys HOT 1
- Self-referenced schemas trigger an exception
- Support for compound indexes HOT 1
- Global error HOT 1
- Custom message not working HOT 9
- mongoose-beautiful-unique-validation schema tree traversal can reach Mongo driver through $$context
- Custom message detection in nested schema failed - max call stack size exceeded
- Custom message detection in nested schema failed - max call stack size exceeded
- Adding updateOne and updatedMany postHooks HOT 1
- Plugin validating unique on a non unique field
- Not working with mongoose latest ( 5.7.0 ) HOT 1
- ValidationError contains empty errors property HOT 3
- Not working with mongoose 5.9.3 HOT 2
- Are all errors supposed to be returned? HOT 1
- Doesn't work with mongoose 5.12.5 and nestjs
- Version 7.1.1 Doesn't work mongoose 6.0.9 && mongo version 4.2 HOT 1
- Working with mongoose v6 HOT 1
- Mongoose unique error is now a MongoServerError not MongoError
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoose-beautiful-unique-validation.