Skip to content

Commit

Permalink
back to last conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Carlos Muñoz committed May 14, 2024
1 parent 61d9bc5 commit 9ec88f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = function (schema, options) {
if (model.baseModelName && indexOptions.partialFilterExpression === null) {
model = model.db.model(model.baseModelName);
}
conditions = {...indexOptions.partialFilterExpression, ...conditions};
conditions = {$and: [conditions, indexOptions.partialFilterExpression || {}]};

const count = await model.find(conditions).countDocuments();
return count === 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mongoose-unique-validator",
"version": "3.0.1",
"version": "3.0.2",
"description": "mongoose-unique-validator is a plugin which adds pre-save validation for unique fields within a Mongoose schema.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 9ec88f5

Please sign in to comment.