Mongo ids leads to scary URLs

前端 未结 4 1245
时光取名叫无心
时光取名叫无心 2020-12-24 01:52

This might sound like a trivial question, but it is rather important for consumer facing apps

What is the easiest way and most scalable way to map the scary mongo id

4条回答
  •  春和景丽
    2020-12-24 02:07

    Unfortunately, the key macro has been removed from mongo. For custom ids, users must now override the _id field.

    class Band
      include Mongoid::Document
      field :_id, type: String, default: ->{ name }
    end
    

提交回复
热议问题