CampbellSoftwareSolutions / mongoose-id-validator

Mongoose plug in to validate ObjectID references point to valid existing documents.
Other
47 stars 26 forks source link

Mongoose v5.6.0 breaks plugin and tests #32

Open joelrorseth opened 5 years ago

joelrorseth commented 5 years ago

After updating to the latest mongoose v5.6.13, I noticed that a bunch of my tests were failing. Turns out they were all due to this plugin no longer functioning properly. It appears that the plugin is no longer working when inserted at the global or schema level.

After cloning the repo and running the tests, I discovered that the following are failing for mongoose ^5.6.0:

  1. Should fail validation with custom message on bad ID
  2. Should fail validation on bad ID with IdValidator instance
  3. Should fail validation if bad ID set after previously good ID value
  4. Should fail ID validation in an array of ID references
zproxyz commented 5 years ago

@joelrorseth This PR #33 solves this issue. Waiting @martin-css for making and publishing new release