1.0.1 • Published 3 years ago

mongoose-auto-increment-ts v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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