Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby ODM for MongoDB
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
data
features
lib
script
spec
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION
mongod.example.yml
mongodoc.gemspec

README.rdoc

mongodoc

Version: 0.1 12/7/09

Introduction

mongodoc is yet another ODM for MongoDB in Ruby.

Here is an example:

require 'mongodoc'

class Address < MongoDoc::Document
  key :street
  key :city
  key :state
  key :zip_code
end

class Contact < MongoDoc::Document
  key :name
  key :interests
  has_many :addresses
end

MongoDoc.connect
contact = Contact.new(:name => 'Joe Strummer', :interests => ['music', 'art', 'acting'])
contact.addresses << Address.new(:street => '1 Main Street', :city => 'Anywhere', :state => 'ID', :zip_code => '56789')
contact.save

Contact.criteria.in({'interests' => ['ruby', 'art']}).first
Contact.criteria.where('addresses.state' => 'ID').first

Installation

Credits

Les Hill, leshill on github

mongodoc

Thanks

Thanks to Sandro and Durran for some great conversations and some lovely code.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2009 Les Hill. See LICENSE for details.

Something went wrong with that request. Please try again.