Introduction to MongoDB

16
Introduction to Presenter: Faizan Mustaf

description

Presented during company meeting. This serves as an introduction to MongoDB and non-relational database architecture

Transcript of Introduction to MongoDB

Page 1: Introduction to MongoDB

Introduction to

Presenter: Faizan Mustafa

Page 2: Introduction to MongoDB

Agenda Document based database

MongoDB

MongoDB vs RDBMS

MongoDB Database Archtecture Document

Collection

Naming Convention

Sharding

Replication

Basic Query Syntax

Demo: Installation

Demo: Basic Querying

Page 3: Introduction to MongoDB

Document oriented database

Created over an abstract notation of a “document”

Key-value pair

Semi structured data

  {     FirstName: "Bob",     Address: "5 Oak St.",     Hobby: "sailing"  }

{    FirstName: "Jonathan",    Address: "15 Wanamassa Point Road",    Children:  [          {Name: "Michael", Age: 10},          {Name: "Jennifer", Age: 8},         {Name: "Samantha", Age: 5},          {Name: "Elena", Age: 2}     ]   }

Page 4: Introduction to MongoDB

MongoDB Humongous

Document oriented database using JSON document syntax

Features: Flexibilty

Power

Scaling

Ease of Use

Built-in Javascript

Clientele: Craigslist, eBay, Foursquare, SourceForge, and The New York Times.

Page 5: Introduction to MongoDB

MongoDB vs. RDBMS

RDBMS MongoDB

Database Database

Table Collection

Record Document

Index Index

Partition Shard

Foreign Key Reference

Page 6: Introduction to MongoDB

MongoDB vs. RDBMS

Page 7: Introduction to MongoDB

MongoDB Database Architecture Document:

{

_id: ObjectId("5099803df3f4948bd2f98391"),

name: { first: "Alan", last: "Turing" },

birth: new Date('Jun 23, 1912'),

death: new Date('Jun 07, 1954'),

contribs: [ "Turing machine", "Turing test", "Turingery" ],

views : NumberLong(1250000)

}

Page 8: Introduction to MongoDB

MongoDB Database Architecture Collection:

Logical group of documents

May or may not share same keys

Schema is dynamic/application maintained

Page 9: Introduction to MongoDB

Sharding (a.k.a Partitioning)

Page 10: Introduction to MongoDB

Replication

Page 11: Introduction to MongoDB

Replication

Page 12: Introduction to MongoDB

Naming Convention Dot notation

database_name.collection_name

‘embedded_document.key_name’

Page 13: Introduction to MongoDB

Selecting Data

Page 14: Introduction to MongoDB

Demo Time!

Page 15: Introduction to MongoDB

Questions?

Page 16: Introduction to MongoDB

Thank you