/nodejs-mongoose-autoincrement-simple

Simple Mongoose AutoIncrement Implementation

Primary LanguageJavaScript

nodejs-mongoose-autoincrement-simple

Simple Mongoose AutoIncrement Implementation , No Plugin Required.

Simply ,

  1. Add counter.model.js in your models folder
  2. Call "getSetAutoIncrementId" Pre Hook "save" or "findoneandupdate" in your Model.

Refer Example Folder for Quries.

Additionally You can Specify which field you want to refer for AutoIncrement.