0.3.5 • Published 2 years ago

mondec v0.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Features

  • Lightweight
  • Class based schemas
  • Easy usage with TS decorators

Installation

Using npm:

npm install mondec

Using yarn:

yarn add mondec

Using pnpm:

pnpm add mondec

You need to enable emitting decorator metadata in your Typescript config. Add these two lines to your tsconfig.json file under the compilerOptions key:

"emitDecoratorMetadata": true,
"experimentalDecorators": true

Usage

import mongoose from 'mongoose'
import { Prop, Schema, SchemaFactory } from 'mondec'

@Schema({
  versionKey: false
})
class User {
  @Prop({
    type: String,
    unique: true,
    required: true
  })
  public username!: string

  @Prop({
    type: Number
  })
  public age!: number
}

const UserSchema = SchemaFactory.createForClass(User)
const UserModel = mongoose.model('users', UserSchema)
type UserDocument = ReturnType<(typeof UserModel)['hydrate']>

Contributing

  1. Fork this repository.
  2. Create a new branch with feature name.
  3. Create your feature.
  4. Commit and set commit message with feature name.
  5. Push your code to your fork repository.
  6. Create pull request.

License

MIT

0.3.0

2 years ago

0.2.0

2 years ago

0.1.8

2 years ago

0.3.5

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago