download
npm i --save mongoose-auto-increment-2
why
- the available mongoose auto increment plugins seem to not be maintained.
- none of them use a sparse index, which can lead to chaos in case of null fields.
- none of the plugins self heal the index.
- no ability to change name of counters collection, which could matter for some people.
- none prevent modification of the index field
usage
plugin usage
var mongoose = ;var autoincrement = ;var PersonSchema = name : type: String ; PersonSchema; var Person = mongoose;
healing collection
var Person = ;//selfheal collectionPerson;
changing name of collection
var autoincrement = ;autoincrement;