Archive for the ‘MongoDB’ Category

Simple MongoDB model configuration


Here is a simple Model configuration with MongoDB,

class Item
include MongoMapper::Document
key :user_id, ObjectId
key :name, String, :required => true
key :short_description, String
key :liked_by, Array
key :custom_url, String
key :item_url, String
key :category_id, String
key :source_id, String
key :source_name, String
key :points, Float, :default => 0.0
key :item_image_url, String
# Relationships
# Validations.
# methods
end