mongoose-auto-increment-ts
v1.0.1
Published
Hello I am kundan kumar after 3 hours frustration i make this module
Downloads
12
Maintainers
Readme
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