Next level ORM for popular databases
This module has full typescript support.
npm i @wyesoftware/nextormyarn add @wyesoftware/nextormGenerate mongo models from custom schema placed in ${project}/nextorm/model.ts(.js) with output in ${project}/nextorm/generated/nextorm.ts(.js):
nextorm mongo:generateGenerate mongo models from custom schema placed in ${customPath} with output in ${customPath}/generated/nextorm.ts(.js):
nextorm mongo:generate --model ${customPath}Also you can change output path to custom path:
nextorm mongo:generate --model ${customPath} --output ${outputPath}- Generate mongo models from custom schema - works with limits
- Strongly typed mongoose functions - in development
- Migration from custom schema - in development
- Strongly typed betterSqlite functions - in development
import{Model,MongoTypes}from"@wyesoftware/nextorm";exportconstDatabase: Model={Users: {// schema name_id: true,// auto-generated ObjectIdtimestamps: true,// createdAt, updatedAtname: "users",// collection name in mongoindexes: {fields: {email: "asc",age: "desc",},unique: true,},email: {// field name in mongotype: MongoTypes.String,// field typerequired: true,// field is requiredunique: true,// field is uniqueindex: true,// field is indexed},password: {type: MongoTypes.String,required: true,},age: {type: MongoTypes.Number,required: false,},},};- Add support for multiple indexes in collection