Book Details

About This Book

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

Who This Book Is 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.

Table of Contents

Chapter 1: Installing MongoDB and Ruby

Installing Ruby

Installing MongoDB

Configuring the MongoDB server

Starting MongoDB

Stopping MongoDB

The MongoDB CLI

Installing Rails/Sinatra

Summary

Chapter 2: Diving Deep into MongoDB

Creating documents

Time for action — creating our first document

Using MongoDB embedded documents

Time for action — embedding reviews and votes

Using MongoDB document relationships

Time for action — creating document relations

Comparing MongoDB versus SQL syntax

Using Map/Reduce instead of join

Time for action — writing the map function for calculating vote statistics

Time for action — writing the reduce function to process emitted information

Understanding the Ruby perspective

Time for action — creating the project

Time for action — start your engines

Time for action — configuring Mongoid

Time for action — planning the object schema

Time for action — putting it all together

Time for action — adding reviews to books

Time for action — embedding Lease and Purchase models

Time for action — writing the map function to calculate ratings

Time for action — writing the reduce function to process the emitted results

What You Will Learn

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

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.

Authors

Gautam Rege

Gautam Rege has been working in Ruby since 2007 and has been experimenting a lot with MongoDB. He believes Ruby is indeed the language of the next generation – very human-readable, flexible and extremely enjoyable. MongoDB is the new age NoSQL forerunner. It has rightly started to gain ‘humongous’ patronage.
Gautam works a lot in Rails and at Josh Software Private Limited, the company he co-founded, working exclusively in Ruby and Ruby-related technologies. He is well versed with Rhodes (the Ruby mobile framework), Merb, Sinatra and occasionally also experiments with JS frameworks like Sproutcore, and Backbone.js

Table of Contents

Chapter 1: Installing MongoDB and Ruby

Installing Ruby

Installing MongoDB

Configuring the MongoDB server

Starting MongoDB

Stopping MongoDB

The MongoDB CLI

Installing Rails/Sinatra

Summary

Chapter 2: Diving Deep into MongoDB

Creating documents

Time for action — creating our first document

Using MongoDB embedded documents

Time for action — embedding reviews and votes

Using MongoDB document relationships

Time for action — creating document relations

Comparing MongoDB versus SQL syntax

Using Map/Reduce instead of join

Time for action — writing the map function for calculating vote statistics

Time for action — writing the reduce function to process emitted information

Understanding the Ruby perspective

Time for action — creating the project

Time for action — start your engines

Time for action — configuring Mongoid

Time for action — planning the object schema

Time for action — putting it all together

Time for action — adding reviews to books

Time for action — embedding Lease and Purchase models

Time for action — writing the map function to calculate ratings

Time for action — writing the reduce function to process the emitted results

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.