Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

mongoose-naxmefy-autoinc-field

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-naxmefy-autoinc-field

mongoose plugin for auto incremented fields

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

mongoose-naxmefy-autoinc-field

mongoose plugin for auto incrementing fields

npm version

Build Status Coverage Status

NPM

installation

$ npm install --save mongoose-naxmefy-autoinc-field

usage without options (ModelName as String)

var mongoose = require("mongoose");
var autoIncLib = require("mongoose-naxmefy-autoinc-field");
var autoIncPlugin = autoIncLib(mongoose);

//...

var MyModelSchema = new mongoose.Schema({
  //...
});

// This will add field "autoIncId"
MyModelSchema.plugin(autoIncPlugin('MyModel'));

//...

var MyModel = mongoose.model('MyModel', MyModelSchema);

options for autoIncLib

var mongoose = require("mongoose");
var autoIncLib = require("mongoose-naxmefy-autoinc-field");
var autoIncPlugin = autoIncLib(mongoose, {
  collection: 'MyAutoIncCollection' // Name of collection which stores the auto inc counters
});

//...

options for autoIncPlugin

var mongoose = require("mongoose");
var autoIncLib = require("mongoose-naxmefy-autoinc-field");
var autoIncPlugin = autoIncLib(mongoose);

//...

// This will add field "autoIncId"
MyModelSchema.plugin(autoIncPlugin({
  model: "MyModel", //name of this model
  field: "myModelId", // field for auto inc
  startAt: 500, // start counter (not the first!!!)
  incrementBy: 114 // increment value (first will be startAt + incrementBy - here 614)
}));

//...

contributing

found bug? create issue!

missing feature? fork, implement and start pull request...or be lazy and create an issue...

license

MIT

Keywords

mongoose

FAQs

Package last updated on 15 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts