README.rdoc in dm-mongo-adapter-0.2.0.pre3 vs README.rdoc in dm-mongo-adapter-0.6.0
- old
+ new
@@ -1,61 +1,50 @@
= DataMapper MongoDB Adapter
+== Status
+
+The adapter is going through a major re-work as DataMapper will soon support EmbeddedValue (see: http://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 (http://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:
* http://github.com/solnic/dm-mongo-adapter
* http://groups.google.com/group/dm-mongo-adapter
* http://rdoc.info/projects/solnic/dm-mongo-adapter
== Dependencies
Ruby gems
-* dm-core ~> 0.10.2
-* dm-aggregates ~> 0.10.2
-* mongo ~> 0.18.3
+* dm-core ~> 1.1.0
+* dm-aggregates ~> 1.1.0
+* mongo ~> 1.2.4
== Install
- gem install dm-mongo-adapter --pre
+ gem install dm-mongo-adapter
== Synopsis
DataMapper.setup(:default,
:adapter => 'mongo',
:database => 'my_mongo_db',
)
- # Define embedded resources
- class Address
- include DataMapper::Mongo::EmbeddedResource
-
- property :street, String
- property :city, String
- property :state, String
- property :postal_code, String
- end
-
- class Score
- include DataMapper::Mongo::EmbeddedResource
-
- property :grade, Float
- property :course_id, DBRef
-
- belongs_to :course
- end
-
- # Define top-level resources
+ # Define resources
class Student
include DataMapper::Mongo::Resource
property :id, ObjectID
property :name, String
property :age, Integer
-
- embeds 1, :address, :model => Address
- embeds n, :scores
end
class Course
include DataMapper::Mongo::Resource
@@ -65,19 +54,11 @@
# No need to (auto_)migrate!
biology = Course.create(:name => "Biology")
english = Course.create(:name => "English")
- # Nested attributes
- student = Student.create(:name => "John", :age => "26",
- :address => { :street => "123 Main St.", :city => "New York", :state => "NY", :postal_code => "10014" },
- :scores => [ { :grade => 4.0, :course_id => biology.id }, { :grade => 3.0, :course_id => english.id } ])
-
# Queries
Student.all(:age.gte => 20, :name => /oh/, :limit => 20, :order => [:age.asc])
-
- # Reaching into embedded objects
- Student.all(:"address.state" => "NY")
# Array and Hash as a property
class Zoo
include DataMapper::Mongo::Resource