This will enable one to use SQL-like sequence for id (_id).
include MongoMapper::Document include UseSequenceAsMongoId
When you do
Foo.create(:explicit_key => 'bar', :implicity_key => 'cake')
even when :implicity_key was not definied (i.e. key :implicity_key, String), MongoMapper will still create the new key and insert the document.
If you want to disable that for mantainability, do
include SaveToMongoKeysOnly include MongoMapper::Document
Sometimes there's no reason to use id for embedded documents. Just do
include NoEmbeddedMongoId include MongoMapper::EmbeddedDocument
When you do
Foo.all(:array => [1,2])
what you get is actually
Foo.all(:array.in => [1,2])
which is fine in most case, but sometimes you just want to match the exact array (as in spatial data). Now you can do
Foo.all(:array.e => [1,2])
which guarantees no operator will be used.
All the old tests pass. But I still need to write tests for the new features.
key :lat_lng, Array # or use embedded document type ensure_index [[:lat_lng, "2d"]]
A Ruby Object Mapper for Mongo.
Releases are tagged on github and released on gemcutter. Master is pushed to whenever I add a patch or a new feature, but I do not release a new gem version each time I push.
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 in another branch so I can ignore when I pull)
Send me a pull request. Bonus points for topic branches.
$ gem install mongo_mapper
Hit up the google group. groups.google.com/group/mongomapper
To see if the problem you are having is a verified issue, you can see the MM pivotal tracker project: www.pivotaltracker.com/projects/33576
There is no need to request to join the Pivotal Tracker project as I am only granting access to a select few (easier to keep things organized). If you have a problem, please use the mailing list. If I confirm it to be a bug, I am happy to add it to PT. Thanks!
Copyright © 2009 John Nunemaker. See LICENSE for details.