Open
Description
I have the following code
class SizeList
include Mongoid::Document
field :_id, type: Integer
field :name
auto_increment :sequence, :seed => -1, :step => 1
before_create { self.id = self.sequence }
end
I want the sequence to be continuous. This works really well, except in the case when create fails. It should decrease the sequence in such cases.
You should probably use after_add callback to increase the auto increment value.
Although i can still live with it.