I wanted to use integer values for ID, so i updated my model to this:
class Word
include Mongoid::Document
field :id, type: Integer
field :name, type: String
before_create :assign_id
private
def assign_id
self.id = Word.count.to_i + 1
end
end
Only downside, that i can think of, is that i have to make sure i handle deletion correctly. So any other tables, that have this id, gets updated, on destroy. But other than that it works, but could there be any problems, by doing this?