@ark7/model-mongoose
Advanced tools
Comparing version 2.0.53 to 2.0.54
@@ -630,3 +630,6 @@ "use strict"; | ||
if ((_d = field.field) === null || _d === void 0 ? void 0 : _d.indexDisabled) { | ||
target.type = cloneMongooseSchemaDisableIndex(target.type); | ||
target.type = cloneMongooseSchemaDisableIndex({ | ||
schema: target.type, | ||
clone: true, | ||
}); | ||
} | ||
@@ -669,7 +672,12 @@ options.schema[field.name] = target; | ||
exports.shareFns = ['on']; | ||
function cloneMongooseSchemaDisableIndex(schema) { | ||
const c = schema.clone(); | ||
function cloneMongooseSchemaDisableIndex(options) { | ||
const c = options.clone ? options.schema.clone() : options.schema; | ||
c._indexes = []; | ||
c.eachPath((_path, type) => { | ||
type._index = null; | ||
if (type.schema != null) { | ||
cloneMongooseSchemaDisableIndex({ | ||
schema: type.schame, | ||
}); | ||
} | ||
}); | ||
@@ -676,0 +684,0 @@ return c; |
{ | ||
"name": "@ark7/model-mongoose", | ||
"version": "2.0.53", | ||
"version": "2.0.54", | ||
"description": "Type-script friendly, object-oriented, database modeling framework", | ||
@@ -5,0 +5,0 @@ "types": "index.d.ts", |
Sorry, the diff of this file is not supported yet
276431
3899