@kenote/mongoose
TypeScript icon, indicating that this package has built-in type declarations

1.0.40 • Public • Published

@kenote/mongoose

Auxiliary tool for Mongoose.

NPM Version NPM Downloads Gratipay

使用方法

import { model, Schema } from 'mongoose'
import { modelDao } from '@kenote/mongoose'

const userModel = model('user', new Schema({
  id: {
    type: Number,
    default: 0,
    index: { unique: true }
  },
  username: {
    type: String,
    required: true
  }
}))

modelDao(userModel, {
  select: ['username'],
  populate: {
    path: ''
  },
  sort: { _id: 1 },
  limit: 10
})

MIT License.

/@kenote/mongoose/

    Package Sidebar

    Install

    npm i @kenote/mongoose

    Weekly Downloads

    1

    Version

    1.0.40

    License

    MIT

    Unpacked Size

    85.3 kB

    Total Files

    30

    Last publish

    Collaborators

    • thondery