Skip to content

Issue when generating type from schema #177

@rakakhrl

Description

@rakakhrl

I recently got issue when running npx mtgen in my project.

parser: Unknown type detected for field "type", using type "any". Please create an issue in the mongoose-tsgen GitHub repo to have this case handled.

I never got this before and now my type export got capitalized i.e. SomeThing when it should be someThing and cause import error on my application.

Do I have to change all import statement to follow this capitalized export?

// from
import {someThing} from "somewhere";

// to
import {SomeThing} from "somewhere";

Do I have to change my model definition to capitalized when my mongodb collection use lower case?

// from
const SomeThing = mongoose.model<someThing, SomeThingModel>("something", SomeThingSchema);

// to
const SomeThing = mongoose.model<SomeThing, SomeThingModel>("Something", SomeThingSchema);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions