francescov1 / mongoose-tsgen

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

Mongoose map exceeds call stack #28

Closed www-chique closed 3 years ago

www-chique commented 3 years ago

I'm using the Mongoose map example, as follows

const EmailTemplateSchema = new Schema(
    {
        content: {
            type: Map,
            of: String,
        },
    }
);

Running mtgen shows the following error image

However, it works fine if I use Object instead of Map. Am I doing something wrong like a newbie I am?

Many thanks for your help with all the issues.

francescov1 commented 3 years ago

This is related to handling Mongoose Maps, my bad! I already had this fix nearly done, just need to finish tests and will release.

www-chique commented 3 years ago

@francescov1 - No problem. I'm really grateful to you for this wonderful tool. Take your time.

francescov1 commented 3 years ago

Published in 7.0.5!

Note that I am aware of a small cleanup that needs to be done to remove duplicate properties on Document types (ie EmailTemplateDocument["content"] = mongoose.Map<string> & Map<string, string> even though the Document property should only contain the mongoose.Map type). Based on prelim testing it seems like this should be fine for now but I'm not entirely sure if it could cause issues when trying to use a mongoose map (I dont have many Mongoose projects that use maps so I wasn't able to test as much as I would like). Let me know if there are any issues!

francescov1 commented 3 years ago

Note that I am aware of a small cleanup that needs to be done to remove duplicate properties on Document types (ie EmailTemplateDocument["content"] = mongoose.Map<string> & Map<string, string> even though the Document property should only contain the mongoose.Map type). Based on prelim testing it seems like this should be fine for now but I'm not entirely sure if it could cause issues when trying to use a mongoose map (I dont have many Mongoose projects that use maps so I wasn't able to test as much as I would like). Let me know if there are any issues!

Addressed in 7.0.6!