So I have a scenario where I need unique random 5 or 6 digit numbers to be stored as booking Id of my customers. So I simply create random numbers using.
var booking_id_customer = Math.floor(Math.random()*900000) + 10000;
Than store them in my mongodb as
booking_id_customer: {
type: Number,
index: { unique: true }
},
But I am running out of numbers now, I don't have idea about how to handle this but the requirements are 5 or 6 digit random numbers only. How to handle this situation any hint will be a great idea.
via sac Dahal
No comments:
Post a Comment