用最新版本的Mongoose 4和5更新的优化和测试以及新功能重写了 。
目录
基本用法
该插件会在提供的架构上创建一个预先保存的中间件,该中间件会生成一个自动递增的ID,因此必须在架构变成模型之前应用它。
import { MongooseAutoIncrementID } from 'mongoose-auto-increment-reworked' ;
import * as mongoose from 'mongoose' ;
const MySchema = new mongoose . Schema ( {
someField : {
type : String
}
} ) ;
/*
* An optional step - set the name of the schema used by the plugin (defaults to 'IdCounter'). Has no effect if
* the plugin has already been applied to a schema.
*/
MongooseAutoIncrement
评论0
最新资源