This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Jun 21 18:41:41 -0700 2009 | |
| |
LICENSE | Sun Jun 21 18:41:41 -0700 2009 | |
| |
README.rdoc | Mon Nov 02 13:37:06 -0800 2009 | |
| |
Rakefile | Thu Jun 25 07:29:32 -0700 2009 | |
| |
VERSION.yml | Tue Jun 23 21:45:14 -0700 2009 | |
| |
dm-mongo-adapter.gemspec | Thu Jun 25 07:29:57 -0700 2009 | |
| |
lib/ | Fri Dec 04 12:48:54 -0800 2009 | |
| |
spec/ | Fri Dec 04 12:48:54 -0800 2009 |
README.rdoc
DataMapper Mongo Adapter
WARNING
This adapter is a work-in-progress, so stay tuned :)
TODO
Embedded Objects
I have no idea. I’d guess a DM::Relationship#has hack or custom DM::Types that behave like a table-less resource?
Associations
The documentation for Mongo is confusing so I’m not sure if DBRef’s are deprecated or not.
Query Performance
At the moment a single Javascript $where clause is built. Your indexes probably won’t be used. A mixture of Hash conditions plus a Javascript $where clause when required would be much better.
Dependencies
Ruby::
- dm-core ~> 0.10.2
- mongo ~> 0.16
Install
- Via git:
git clone git://github.com/shanna/dm-mongo-adapter.git rake install
Synopsis
DataMapper.setup(:default,
:adapter => 'mongo',
:database => 'my_mongo_db',
)
# Define your DataMapper resource and start saving:
class User
include DataMapper::Resource
property :id, DataMapper::Mongo::Types::ObjectID, :field => '_id', :key => true
property :name, String
property :age, Integer
end
# No need to (auto_)migrate!
User.create(:name => 'Fred', :age => '25')
# Conditions:
users = User.all(:age.gte => 10, :limit => 20, :order => [:age.asc])
Contributing
Go nuts. Just send me a pull request (github or otherwise) when you are happy with your code.
Copyright
Copyright © 2009 "Shane Hanna". See LICENSE for details.







