Introduction of MongoDB

MongoDB is an open source database that uses a document-oriented data model.

MongoDB is one of several database types to arise in the mid-2000s under the NoSQL banner. Instead of using table and rows as in relation database, MongoDB is built on an architecture of collections and documents. Documents comprise sets of key-value-pairs and are the basic unit of data in MongoDB. Collections contain sets of documents and function as the equivalent of relational database tables.

Installation

First let's install MongoDB from their official repository:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" \
| tee -a /etc/apt/sources.list.d/10gen.list sudo apt-get -y update sudo apt-get -y install mongodb-10gen

Rails part

Rails Configuration

# creating new app ignoring active record database
rails new mongoApp --skip-active-record 
gem 'mongoid', '~> 6.1.0' # add to your gemfile
bundle install
rails g mongoid:config
rails g scaffold author name:string age:integer 
sudo service mongod start # console
rails server
      
Once your parametrization are done and servers are up, you can make request to your mongo database.

mongo # console command launching mongo
use mongo_app_development 
db.authors.find().pretty()
      
Check this link if you want more rails examples or this link in spanish