-
Notifications
You must be signed in to change notification settings - Fork 25
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
run mtgen got error: RangeError: Maximum call stack size exceeded #76
Comments
Hey @aaronyu6, can you provide an example of the schema in question? Thanks! |
below is the schema file |
import * as mongoose from "mongoose"; const PerCatStat = new Schema({ /*cdd is shortform of candidate export const Candidate = mongoose.model("CddStat", CddStatSchema) |
below is the package-lock.json |
Hi @aaronyu6 , Im not able to reproduce this. Can you provide a simple repo to repro? Thanks |
Havent seen this occur with any other users and unable to repro, going to close off for now. Feel free to re-open if its still occurring. |
@francescov1 Hello. If you set any attribute of your model to: { type: 'Boolean', default: false } script will throw Maximum call stack size exceeded on parseSchema fn here:
|
@iserdmi Will put up a fix shortly. As a workaround, you can use |
@iserdmi Fix is live in |
@francescov1 Thank you very much for this fix! But now I faced with another problem. Looks like that they are related to each other. I have model:
Generator works fine and generate this:
Then I apply it to my schema:
And now whole object inside new Schema() marked as red with message: "Type instantiation is excessively deep and possibly infinite" I get this error in all my other schemas. My mongoose version: 6.3.5 Can you please help me, to figure out? I am trying to move my project form js to ts. I am already tried typegoose (don't like it). I am already tried to make types for my models by my self (don't like it). I think mongoose-tsgen — the best approach, but I need some help to implement it 🙂 |
I believe this issue is due to an incompatibility with a new Mongoose Typescript change, see here for more details. We likely wont be addressing this problem, since the next major version of Mongoose contains type inference and will make this package obsolete. In the meantime, you can use |
@francescov1 Thanks for recomendation! Tell me please, where I can read more about «next major version of Mongoose contains type inference»? |
@iserdmi Here is the PR Automattic/mongoose#11563. It looks like I will be continuing support for mongoose-tsgen since there's quite a few use cases in which it is still useful. See the comments at the end of that PR for more details |
tsgen error RangeError: Maximum call stack size exceeded
environment: mongoose 5.13.10
Solution: mongoose must run with version 6, version 5.x.x cause the above error. don't know why
The text was updated successfully, but these errors were encountered: