Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-unique-validator

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-unique-validator - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

5

CHANGELOG.md
# Changelog
## 3.1.0
- Fixes "expected _id to be unique" errors.
- Fixes error when `model` is the name of a field.
## 3.0.0

@@ -4,0 +9,0 @@

13

index.js

@@ -61,2 +61,7 @@ 'use strict';

const conditions = {};
if (!isNew && !isQuery && !parentDoc.isModified(pathName)) {
return resolve(true);
}
each(paths, (name) => {

@@ -107,2 +112,4 @@ let pathValue;

model = this.model(this.constructor.modelName);
} else {
model = this.constructor.model(this.constructor.modelName);
}

@@ -113,3 +120,4 @@

// https://github.com/Automattic/mongoose/issues/4965
if (model.baseModelName && indexOptions.partialFilterExpression === null) {
// eslint-disable-next-line
if (model.baseModelName && (indexOptions.partialFilterExpression === null || indexOptions.partialFilterExpression === undefined)) {
model = model.db.model(model.baseModelName);

@@ -129,6 +137,5 @@ }

plugin.defaults = {
};
plugin.defaults = {};
// Export the mongoose plugin
module.exports = plugin;
{
"name": "mongoose-unique-validator",
"version": "3.0.0",
"version": "3.1.0",
"description": "mongoose-unique-validator is a plugin which adds pre-save validation for unique fields within a Mongoose schema.",
"main": "index.js",
"scripts": {
"test": "mocha test --exit && ./node_modules/eslint/bin/eslint.js index.js test",
"test": "mocha test --exit",
"lint": "eslint index.js test"

@@ -34,4 +34,4 @@ },

"chai": "^4.3.4",
"eslint": "^7.32.0",
"mocha": "^9.1.2",
"eslint": "^8.16.0",
"mocha": "^10.0.0",
"mongoose": "^6.0.0"

@@ -38,0 +38,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc