Interacting with MongoDB using Rails 3 and MongoMapper

MongoDB is an opensource document-oriented database in the vein of CouchDB. It’s been a while since I wanted to try this kind of database on a Rails project. After reading this nice tutorial today I decided to take some time to create a sample Rails 3 app and put it on github.

I chose to use MongoMapper, a ruby object mapper for Mongo. MongoMapper uses ActiveModel and let you interact with a MongoDB database in a very ActiveRecord way.

Hope this sample app will help you getting started with MongoDB!

  • Sasan

    Thanks for the great sample. It would be great if you could give instructions on how you built the whole applications i.e. what tools and techniques you used.

  • http://www.rubyfleebie.com Frank

    Thanks for your suggestion Sasan. It’s true that this post would have been better if it had some code samples and configuration explanations! I was feeling lazy when I wrote this one

  • Pingback: ehcache.net()

  • chabab

    it’s a geat sample for a begginer like me, i appreciate your work,
    thank you very much.

  • apy

    hey all,

    I am having a problem with rails3 integration with mongodb, using ruby 1.8.7 inside. i have put the database configurations in database.yml, but when i start my app on the browser it gives me an error of the mongodb adapter. I have tried a slution i left database file empty and restarted the server afterthat when i ran the app over the browser it gives me “no method error []“. afterthat i have reverted the database configurations in the yml file as it is, and hit ctrl+f5 over the browser with restarting the server and the result was unacceptable.. my app started working.. i know there are some glitches in the configuration of database.. any kind of help will be appreciated. thanks