simple-mongoose-autoincrement

1.2.1 • Public • Published

Mongoose Auto-Increment

Mongoose plugin for auto-increment number ID and given field name.

Install

npm install --save simple-mongoose-autoincrement
or
yarn add simple-mongoose-autoincrement

Usage

// Using with global.
var mongoose = require('mongoose');
var autoincrement = require('simple-mongoose-autoincrement');
 
mongoose.plugin(autoincrement, {/*no field name*/});
// Using with a model and option.
var mongoose = require('mongoose');
var autoincrement = require('simple-mongoose-autoincrement');
var sampleSchema = mongoose.Schema({
  data: String
});
sampleSchema.plugin(autoincrement, {field: 'sequnece' /*with field name*/});

If you need more informations see test.js

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.183latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.183
1.2.00
1.1.00
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i simple-mongoose-autoincrement

Weekly Downloads

83

Version

1.2.1

License

MIT

Last publish

Collaborators

  • moltak