Bhushan Lodha
Bhushan Lodha

Reputation: 6862

Better gem for MongoDB

Given the size of my database and queries I have decided to shift to NoSQL database MongoDb. Are there any gem for using MondoDb with Rails 3. Also, which gem is better?

Upvotes: 0

Views: 269

Answers (2)

Ross
Ross

Reputation: 18111

Use the official driver and to improve performance I'd advise also installing the bson_ext gem as its faster than the native ruby one.

I'm not 100% clear on what the issue is - size or speed. If its speed then make sure you do due diligence and test your dataset before migrating. The MongoDB user group is a great place to get feedback on schema design and appropriate use cases for MongoDB - Its not a panacea and not all use cases are appropriate.

Size wise you are likely to use more space. Data is stored in bson - a compressed Binary Json format, but as MongoDB is schemaless you cant get the size optimizations that a RDMS can provide, for example field names are stored only once in MySQL whereas MongoDB has to store them in each document. Indexes will also increase the size stored on disk and MongoDB also does data preallocation to improve performance which takes up space as well.

For integration with Rails check out the wiki

Hope that helps.

Upvotes: 1

milan
milan

Reputation: 12422

http://www.mongodb.org/display/DOCS/Ruby+Language+Center says how to get the driver, why don't you start there?

Upvotes: 1

Related Questions