francescov1 / mongoose-tsgen

A plug-n-play Typescript generator for Mongoose.
105 stars 25 forks source link

Mongoose map (of array) exceeds call stack #63

Closed www-chique closed 3 years ago

www-chique commented 3 years ago

This is very similar to #28 .

Hey @francescov1 - I ran into the same problem with another Map. I am using an array of Number as the value of the map. The error is: "RangeError: Maximum call stack size exceeded".

new Schema(
    {
        chapters: {
            type: Map,
            of: [Number],
        },
    },
    {
        timestamps: false,
    }
);

Example doc:

{
     _id: ".....",
     chapters: {
          "chapter1": [5, 8, 10, 12],
          "chapter2": [1, 2, 20],
     }
}
francescov1 commented 3 years ago

Hey @www-chique , good catch! This is an edge case I did not foresee. Will be addressed in the following version!

francescov1 commented 3 years ago

Hey @www-chique, sorry for the delay! I've got a fix mostly done but need to clean up a few things, looking to push by end of weekend hopefully!

francescov1 commented 3 years ago

Fixed in 8.3.6 🚀