mongoose-auto-increment-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

mongoose-auto-increment-ts

This is a async/await mongoose auto increment id package

Installation

Install my-project with npm

step1  
npm install mongoose-auto-increment-ts
step2
import { Increment } from 'mongoose-auto-increment-ts'
step3
call Increment function before just add new item in collection
with a collection name save with your desired. 

router.get('/',async (req,res,next)=>{
try{

//enter your collection name 
const id=await Increment('User');


await UserModel.create({
id,
name:'kundan kumar',
address:'Indore MP',
pincode:452015,
linkedin_url:'shorturl.at/frALR'
});

/*
//other example
await UserModel.create({
myid:id,
name:'kundan kumar',
address:'Indore MP',
pincode:452015,
linkedin_url:'shorturl.at/frALR'
});

*/

}catch(err){
next(err)
}

});

Authors

Badges

Add badges from somewhere like: shields.io

MIT License

GPLv3 License

AGPL License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    2
  • 1.0.0
    0

Package Sidebar

Install

npm i mongoose-auto-increment-ts

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

28.9 kB

Total Files

16

Last publish

Collaborators

  • onlykundan