A Mongoose plugin providing additional schema validations for common string formats (email, UUID, credit card, IP, MAC address, etc.). Current stable version is 1.7.1, released in 2021 and maintained intermittently. It works by importing the plugin once and then using validation flags directly in schema definitions (e.g., `email: true`). Compared to alternatives like `mongoose-validator`, this package offers a simpler declarative syntax without custom validator functions.
npm install mongoose-valid8No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Quickly validate email, IP, and credit card using schema flags with async validation.
Upgrade Mongoose to 6.0.7 or later.
Call `validate()` or rely on `save()` to trigger validation.
Use `phone: {locale: 'en-US'}` or check the source for valid options.Check the source: use `aphanumeric: true` (as in README) or `alphanumeric` if fixed in later versions.
Run `npm install mongoose mongoose-valid8`.
Provide a valid email address (e.g., 'user@example.com').
Provide a valid UUID v4 string (e.g., '550e8400-e29b-41d4-a716-446655440000').
Update Mongoose: `npm install mongoose@6`.