class SurveyPagination include Mongoid::Document include Mongoid::Timestamps field :index, type: Integer field :start_section, type: Integer field :end_section, type: Integer belongs_to :questionnaire_survey def as_json(**xargs) res = super({except: :_id}.merge(xargs)) res.merge({_id: self.id.to_s}) end end