I have tried MongoMapper and it is feature complete (offering almost all AR functionality) but i was not very happy with the performance when using large datasets. Has anyone compared with Mongoid? Any performance gains ?
相关问题
- MongoDB can not create unique sparse index (duplic
- Spring Data MongoDB - lazy access to some fields
- Golang mongodb aggregation
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
相关文章
- mongodb有没有什么办法禁止读取数据的时候进行缓存
- mongodb-aggregate聚合查询分组后如何获得多字段
- Ruby using wrong version of openssl
- mongodb error: how do I make sure that your journa
- How to track MongoDB requests from a console appli
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
Mongoid is having a full support with Rails3 and having identity map feature.
More document is at http://mongoid.org
See the performance here http://mongoid.org/performance.html
i've been using both for the past couple weeks. Mongomapper has better support for relational associations (non-embedded) and has greater third-party support. Mongoid has better query support, much better documentation (MM has close to none, though a website is supposedly in the works), Rail 3 support (and thus Devise support) and a slightly more active community on Google Groups.
I ended up going with Mongoid.
If you're using Rails3 I'd recommend Mongoid -- it also uses "include" instead of inheritance "<" to persist classes -- using "include" is the better paradigm in Ruby for adding persistence. Mongoid works fine for me with Devise.
To improve performance, try to selectively use the lower-level access, e.g. Moped - I've seen this to be up to 10x faster
Differences
MongoMapper
Mongoid
Similarities
Configuration
MongoMapper
Mongoid
3rd Party Libraries
Both sides have claimed to have better 3rd party support. Github reveals the following:
Notably, Devise does not support MongoMapper.
Commit Activity
Over the last year, it looks like Mongoid has been more regularly maintained and updated than MongoMapper.
MongoMapper
Mongoid
I think Mongoid is much better at configuration and mapping.
A difference I found is that
update_attribute
in MongoMapper appears to write the whole document, regardless of what attributes actually changed. In Mongoid it only writes the changed attributes. This can be a significant performance issue for large records. This is particularly true for embedded documents (herelabels
), e.g.On
save
, MongoMapper will save the wholeprofile
record, but MongoId will use the$set
operator with positional logic to only update the label that changed.Another issue is selecting which fields to return. Both support an
only
criterion, but Mongoid also supports awithout
criterion, which is natively supported by Mongo.It appears to me that Mongoid just is more "rounded" and complete in its API, which probably explains that it's a larger code base. It also appears documented better.