Ruby and MongoDB Web Development Beginner's Guide

Ruby and MongoDB Web Development Beginner's Guide

Gautam Rege

Language: English

Pages: 332

ISBN: 2:00094763

Format: PDF / Kindle (mobi) / ePub

Create dynamic web applications by combining the power of Ruby and MongoDB

* Step-by-step instructions and practical examples to creating web applications with Ruby and MongoDB
* Learn to design the object model in a NoSQL way
* Create objects in Ruby and map them to MongoDB

In Detail

MongoDB is a high-performance, open source, schema-free document-oriented database. Ruby is an object- oriented scripting language. Ruby and MongoDB are an ideal partnership for building scalable web applications.

Ruby and MongoDB Web Development Beginner's Guide is a fast-paced, hands-on guide to get started with web application development using Ruby and MongoDB. The book follows a practical approach, using clear and step-by-step instructions and examples in Ruby to demonstrate application development using MongoDB.

The book starts by introducing the concepts of MongoDB. The book teaches everything right from the installation to creating objects, MongoDB internals, queries and Ruby Data Mappers.

You will learn how to use various Ruby data mappers like Mongoid and MongoMapper to map Ruby objects to MongoDB documents.

You will learn MongoDB features and deal with geo-spatial indexing with MongoDB and Scaling MongoDB.

With its coverage of concepts and practical examples, Ruby and MongoDB Web Development Beginner's Guide is the right choice for Ruby developers to get started with developing websites with MongoDB as the database.

What you will learn from this book
* Get MongoDB and Ruby up and running on your machine (Windows/Mac/Linux)
* Leverage MongoDB to build highly scalable data-centric applications
* Leverage MongoDB replication to ensure high availability and reliability
* Create your first object and save it to MongoDB
* Create a Ruby Object and map it to MongoDB document
* Process large datasets with MapReduce
* Create geo-spatial indexes or 2D indexes
* Learn about Mongoid and MongoMapper for mapping Ruby objects to MongoDB documents


This book is packed with step-by-step instructions and practical examples, along with accompanying screenshots and code for an easy learning curve. The needs of a beginner are totally satisfied by the book.

Who this book is written for

This book assumes that you are experienced in Ruby development skills - Ruby, HTML, CSS. Having knowledge of using NoSQL will help you get through the concepts quicker, but it is not mandatory. No prior knowledge of MongoDB required.

Murach's MySQL

Understanding TCP/IP

Poverty and the Millennium Development Goals: A Critical Look Forward (International Studies in Poverty Research)

JavaServer Faces: Introduction by Example

A Companion To Marx's Capital

Starting Out with Java: From Control Structures through Objects (5th Edition)














be far behind. Rails 3 packs a punch. Sinatra was born because Rails 2.x was a really heavy framework. However, Rails 3 has Metal that can be configured with only what we need in our application framework. So Rails 3 can be as lightweight as Sinatra and also get the best of the support libraries. So Rails 3 it is, if I have to choose between Ruby web frameworks! Installing Rails 3 or Sinatra is as simple as one command, as follows: $ gem install rails $ gem install sinatra At the time of

objects, it's fine if you get extra data. That is the beauty of NoSQL. When the first document is fetched (the one with the name Fiction), it will not contain the state and comments fields but the second document (the one with the name Romance) will have them. Are you worried what will happen if we try to access non-existing data from an object, for example, accessing comments from the first object fetched? This can be logically resolved—we can check the existence of a key, or default to a value

"username" : "Gautam", "rating" : 9 }, { "username" : "Dick", "rating" : 5 } ] } What just happened? Notice that in both cases, we have mentioned the query and fields parameters as an empty hash. This is just for the sake of brevity! limit is 1 in both cases but the skip values have changed. This would be similar to the following SQL query: SELECT * FROM books LIMIT 1 OFFSET 1 Have a go hero – paginating document results To see pagination in action, it would really be cool if you add 20 books

class_name: "Bar" end Here when we access the relation bar_alias, the Bar class and its collection would be accessed. :inverse_of option In a many-to-many relation, Mongoid saves the information on both sides of the relation. This is called the inverse relation. We shall see a more detailed example in the many-to-many relation later. :name option Suppose we want to reference relations with a different name, then we use this option. For example, if we had location information embedded into

ruby 1.9.2 p180 with gemset myproject In case you need to install something via RVM with sudo access, remember to use rvmsudo instead of sudo! The Windows saga RVM does not work on Windows, instead you can use pik. All the detailed instructions to install Ruby are available at It is pretty simple and a one-click installer. Do remember to install DevKit as it is required for compiling native gems. Using rbenv for installing Ruby Just like all good things, RVM becomes

Download sample