-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinitely hangs inserting complex document with recursive schema #14897
Comments
Note, when simplifying the schema and replacing other portions with |
I see...it isn't that it is INFINITE. It is just effectively infinite. We have a document 40 levels deep and the isDirectModified appears to be on order of N! (factorial). So it will run until we are all dead, but not infinitely. And I don't understand the why it would need to check each level. If it checks the top level, which recursively checks all of the sublevels, it would then need to check the sublevel separately. |
…h 10 level deep subdocs Fix #14897
fix(document): avoid massive perf degradation when saving new doc with 10 level deep subdocs
Prerequisites
Mongoose version
8.4.1+
Node.js version
20.x
MongoDB server version
5.x,6.x
Typescript version (if applicable)
5.4.5
Description
mongoose_test.zip
This test case demonstrates inserting a single document with a complex schema. it is actually simplified from out actual schema in use, and I've replace several subdocuments with
Mixed
. But I expect it is very likely due to the potential recursive nature of the schema.Works as expected in version 8.2.2, 8.3.0 and 8.4.0.
Hangs in 8.4.1 - 8.6.3
Steps to Reproduce
build and run attached app.
Expected Behavior
inserts the document.
The text was updated successfully, but these errors were encountered: