AutoIncrement using mongoose
Please Guys what is the best way to implement AutoIncrement using mongoose, i tried the best two option and it wasnt working
mongoose-sequence
mongoose-auto-increment
3 Replies
Stack Overflow
Mongoose auto increment
According to this mongodb article it is possible to auto increment a field and I would like the use the counters collection way.
The problem with that example is that I don't have thousands of peo...
Aint working
I'm not too good with mongoose, but I'm guessing you could use the "pre" save hook
Create a schema that keeps track of what you want to auto increment
And perform a db call to it increment it and save the new document