We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef79737 commit 0314b02Copy full SHA for 0314b02
1 file changed
lib/helpers/setDefaultsOnInsert.js
@@ -69,7 +69,8 @@ module.exports = function(filter, schema, castedDoc, options) {
69
}
70
71
schema.eachPath(function(path, schemaType) {
72
- if (schemaType.$isSingleNested) {
+ // Skip single nested paths if underneath a map
73
+ if (schemaType.$isSingleNested && !schemaType.path.endsWith('.$*')) {
74
// Only handle nested schemas 1-level deep to avoid infinite
75
// recursion re: https://github.com/mongodb-js/mongoose-autopopulate/issues/11
76
schemaType.schema.eachPath(function(_path, _schemaType) {
0 commit comments