@kenote/mongoose
v1.0.40
Published
Auxiliary tool for Mongoose.
Downloads
3
Readme
@kenote/mongoose
Auxiliary tool for Mongoose.
使用方法
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.