In this module, we’re going to explore the history and the rationale behind NoSQL databases, their relationship to RDBMS, and dive into the basics of MongoDB. We will install MongoDB, create a database, collections and perform CRUD operations. We will end this module by integrating MongoDB with Ruby Shell and try out some simple examples.
- Relational databases -- transactional, support joins whcih is powerful but comes with cost, do not support objects well, static schema
- NoSQL -- better performance, support objects better, scales horizontally, no joins, ACID transactions at document level only. dynamic schema
- Catefories of NoSQL
- Key/Value hashtables -- Redis, Memcache, Dynamo
- Document stores -- MongoDB, CouchDB
- Column -- Cassandra, Hbase
- Graph -- Neo4J
- MongoDB is document-oriented database for JSON-like documents, schemaless; BSON format
- Journaling, write-ahead logging to guarantee write ops
- Basic operations
- Importing sample data
- Capped collections --fixed-zised collections for high throughput, retrieves documents in insertion order
- Insert_one, Insert_many -- returns document containing the status
- Find -- returns an iterator
- id attribute is present in every document, automatically indexed, can be auto-generated or custom-defined
- Find first, last, distinct, count
- Projections -- limits, exclude id
- Paging with limit and skip, sorting
- Find by criteria
- Less and greater, regex, exists, negation, by type
- Replace, update_one and update_many
- Delete_one and Delete_many
- Upsert
- Scaffolding creates view and controller but not the model
- Configure mongoid.yml -- database connection information
- DAO class -- model class to connect to mongodb and access the collection
- ORM mapping -- all, find, save, update and delete
- ActiveModel::Model mixin and helpers
- MVC operations -- show, new, edit, destroy, pagination
In this module, we’re going to explore the fundamentals of the Aggregation framework in MongoDB. We will work on examples where you will process data records and return computed results. You will learn about and get to work on hands-on examples where you will be grouping values from multiple documents and performing a variety of operations on the grouped data to get a single result. We will look at a number of aggregation commands and paging. We will explore some advanced concepts like full text search, GridFS, Geospatial API, and wrap up the module with detailed demonstrations of all the capabilities presented in this module.
In this module, we’re going to explore Mongoid, which is an Object-Document-Mapper (ODM) for MongoDB written in Ruby. We will learn to integrate Mongoid with Rails and work to understand document and relationship mapping, as well. We will work on a number of queries using the Mongoid API and wrap up the module by implementing Rails/Mongoid Model View Controller.
In this module, we’re going to explore Web Services with a focus on caching and security. We will start off by looking at REST fundamentals, RMM (Richardson Maturity Model) and URI best practices. We will wrap up the topic by covering Client and Server Caching along with Web Service Security (OAuth 2).