suweller / mongoid-autoinc

⬆ Auto incrementing fields for Mongoid documents
MIT License
62 stars 44 forks source link

Initialize increment to max value of property in db #26

Closed malibeg closed 8 years ago

malibeg commented 8 years ago

I'm replacing mongoid_auto_increment gem (it doesn't support mongoid ver. 5) with mongoid-autoinc gem.

Autoinc gem is counting sequence property from beginning and I want it to start from max value. Can increment property be initialized with max value for that property in db?

suweller commented 8 years ago

I'm not entirely sure what you mean. Do you mean starting from a given number, like so? https://github.com/suweller/mongoid-autoinc#seeds

malibeg commented 8 years ago

Yes, thank you I found seed. I use seed but since I have testing, staging abd production. I need to set differnet values. I've found that both gems preserve info about inc property in mongo id. So I update seed in mongodb rather than in code