Function buildSchema

  • Generates a Mongoose schema out of class props, iterating through all parents

    Type Parameters

    Parameters

    • cl: U

      The Class to build a Schema from

    • Optional options: IModelOptions

      Overwrite Options, like for naming or general SchemaOptions the class gets compiled with

      Optional

    Returns Schema<DocumentType<InstanceType<U>>>

    Returns the Build Schema

    Example

    class ClassName {}
    const NameSchema = buildSchema(ClassName);
    const NameModel = mongoose.model("Name", NameSchema);

Generated using TypeDoc