Skip to content

Commit 20584b2

Browse files
committed
fix(mongoose): fix build from #12359
1 parent 3bef3cf commit 20584b2

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,8 @@ Mongoose.prototype.model = function(name, schema, collection, options) {
546546
const overwriteModels = _mongoose.options.hasOwnProperty('overwriteModels') ?
547547
_mongoose.options.overwriteModels :
548548
options.overwriteModels;
549-
if (_mongoose.models.hasOwnProperty(name) && options.cache !== false) {
550-
if (overwriteModels !== true &&
551-
originalSchema &&
549+
if (_mongoose.models.hasOwnProperty(name) && options.cache !== false && overwriteModels !== true) {
550+
if (originalSchema &&
552551
originalSchema.instanceOfSchema &&
553552
originalSchema !== _mongoose.models[name].schema) {
554553
throw new _mongoose.Error.OverwriteModelError(name);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mongoose",
33
"description": "Mongoose MongoDB ODM",
4-
"version": "6.5.3",
4+
"version": "6.5.4",
55
"author": "Guillermo Rauch <guillermo@learnboost.com>",
66
"keywords": [
77
"mongodb",

0 commit comments

Comments
 (0)