In my Rails API, I\'d like a Mongo object to return as a JSON string with the Mongo UID as an \"id\" property rather than as an \"_id\" object.
I want my API to retu
class Profile include Mongoid::Document field :name, type: String def to_json as_json(except: :_id).merge(id: id.to_s).to_json end end