c a n d l a n d . n e t

Short MongoDB Fields with Mongoid

Dusty Candland | | mongodb, mongoid

Need to have shorter field name in MongoDB, but still use readable names in code?

# Mongoid Timestamps
include Mongoid::Timestamps::Short

# fields
field :aid, as: :application_id, type:String

# one to one
embeds_one :address, :store_as => :ad

# collections
field :aid, as: :application_id
belongs_to :application, foreign_key: :aid

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: