Automattic / mongoose

MongoDB object modeling designed to work in an asynchronous environment.
https://mongoosejs.com
MIT License
26.88k stars 3.83k forks source link

Infinitely hangs inserting complex document with recursive schema #14897

Open hunkydoryrepair opened 2 hours ago

hunkydoryrepair commented 2 hours ago

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.

hunkydoryrepair commented 2 hours ago

Note, when simplifying the schema and replacing other portions with .Mixed, it does not hang, leading me to believe this is not a mongo driver bug.