Sha256: 7ad7b07776870fd7fd555eb3d799cd84e44e2a5bc7177e4f08c07882b9efde0b

Contents?: true

Size: 1.23 KB

Versions: 29

Compression:

Stored size: 1.23 KB

Contents

MongoModel
==========

MongoModel is a Ruby ORM for interfacing with [MongoDB](http://www.mongodb.org/) databases.


Installation
============

MongoModel is distributed as a gem. Install with:

    gem install mongomodel

For performance, you should probably also install the BSON C extensions:

    gem install bson_ext


Using with Rails 3
==================

Setup config/mongomodel.yml:

    rails generate mongo_model:config DATABASENAME

Generating a model/document:

    rails generate model Article title:string body:string published_at:time approved:boolean 

Generating an embedded document:

    rails generate model Chapter title:string body:string -E


Sample Usage
============

    require 'mongomodel'
    
    MongoModel.configuration = { 'host' => 'localhost', 'database' => 'mydb' }
    
    class Article < MongoModel::Document
      property :title, String, :default => 'Untitled'
      property :body, String
      property :published_at, Time, :protected => true
      property :approved, Boolean, :default => false, :protected => true
      
      timestamps!
      
      validates_presence_of :title, :body
      
      belongs_to :author, :class => User
      
      scope :published, where(:published_at.ne => nil)
    end
    

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
mongomodel-0.4.9 README.md
mongomodel-0.4.8 README.md
mongomodel-0.4.7 README.md
mongomodel-0.4.6 README.md
mongomodel-0.4.5 README.md
mongomodel-0.4.4 README.md
mongomodel-0.4.3 README.md
mongomodel-0.4.2 README.md
mongomodel-0.4.1 README.md
mongomodel-0.4.0 README.md
mongomodel-0.3.6 README.md
mongomodel-0.3.5 README.md
mongomodel-0.3.4 README.md
mongomodel-0.3.3 README.md
mongomodel-0.3.2 README.md
mongomodel-0.3.1 README.md
mongomodel-0.3.0 README.md
mongomodel-0.2.20 README.md
mongomodel-0.2.19 README.md
mongomodel-0.2.18 README.md