You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a triple nested array defined in mongoose. When I try to initialize it with a 2 level deep empty array, it adds a third level. See the following code:
The actual code only check for depth of the current value, and if it matches the depth of the declared Schema. The problem I see is that it doesn't check if values are actually array before wrapping everything into an array.
if (valueDepth.min === valueDepth.max && valueDepth.max < depth) {
for (let i = valueDepth.max; i < depth; ++i) {
value = [value];
}
}
The way it is, it looks like it should loop over the entire array to find if depth is not sufficient AND if items are not arrays.
Uh oh!
There was an error while loading. Please reload this page.
I have a triple nested array defined in mongoose. When I try to initialize it with a 2 level deep empty array, it adds a third level. See the following code:
Wrap up
Versions:
The actual code only check for depth of the current value, and if it matches the depth of the declared Schema. The problem I see is that it doesn't check if values are actually array before wrapping everything into an array.
The way it is, it looks like it should loop over the entire array to find if depth is not sufficient AND if items are not arrays.
Reproductible unit test:
Maybe @vkarpov15 can have an idea on how to fix it, you already take care of a lot of bug on this type of issue (2b9d3b1)
The text was updated successfully, but these errors were encountered: