GithubHelp home page GithubHelp logo

therocketforever / dm-mongo-adapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mbj/dm-mongo-adapter

0.0 2.0 0.0 518 KB

MongoDB DataMapper Adapter

Home Page: https://github.com/solnic/dm-mongo-adapter

License: MIT License

dm-mongo-adapter's Introduction

DataMapper MongoDB Adapter

<img src=“http://travis-ci.org/mbj/dm-mongo-adapter.png?branch=master” />

Status

The adapter is going through a major re-work as DataMapper will soon support EmbeddedValue (see: wiki.github.com/datamapper/dm-core/roadmap) and the adapter will significantly benefit from that fact as there won’t be a need to hack around DM’s private API like it used to be. Apart from embedded docs support there’s plenty of work that needs to be done around MongoDB’s modifier operators (www.mongodb.org/display/DOCS/Updating). With these things done we can start thinking about releasing 1.0.

Contributors are most welcome! In case of any questions you can find me on #datamapper IRC channel.

solnic

Useful links:

Dependencies

Ruby gems

  • dm-core ~> 1.3.0.beta

  • dm-aggregates ~> 1.3.0.beta

  • dm-migrations ~> 1.2.0.beta

  • mongo ~> 1.5.0

  • mongodb ~> 2.0.0 (This gem is only tested against this version)

Install

gem install dm-mongo-adapter

Synopsis

DataMapper.setup(:default,
  :adapter  => 'mongo',
  :database => 'my_mongo_db',
)

# Define resources
class Student
  include DataMapper::Mongo::Resource

  property :id, ObjectId
  property :name, String
  property :age, Integer
end

class Course
  include DataMapper::Mongo::Resource

  property :id, ObjectId
  property :name, String
end

# No need to (auto_)migrate!
biology = Course.create(:name => "Biology")
english = Course.create(:name => "English")

# Queries
Student.all(:age.gte => 20, :name => /oh/, :limit => 20, :order => [:age.asc])

# Array and Hash as a property
class Zoo
  include DataMapper::Mongo::Resource

  property :id, ObjectId
  property :opening_hours, Hash
  property :animals, Array
end

Zoo.create(
  :opening_hours => { :weekend => '9am-8pm', :weekdays => '11am-8pm' },
  :animals       => [ "Marty", "Alex", "Gloria" ])

Zoo.all(:animals => 'Alex')

DataMapper plugins

Currently the adapter is known to work with:

  1. dm-timestamps

  2. dm-validations

  3. dm-aggregates

  4. dm-pager

  5. dm-serializer

  6. dm-types

  7. dm-is-tree

and expect more of course :)

Authors and contributors

The adapter has been originally written by Shane Hanna (shanna). Project is currently maintained by Piotr Solnica (solnic).

Contributors:

  • Anthony Williams (antw)

  • Lance Carlson (lancecarlson)

  • Markus Schirp (mbj)

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 © 2009 “Shane Hanna”, 2009-2010 “Piotr Solnica”. See LICENSE for details.

dm-mongo-adapter's People

Contributors

solnic avatar lancecarlson avatar shanna avatar dkubb avatar shingara avatar

Watchers

Don Wei avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.