Introducción
Goals
asd
Introduction
Mongo Shell / CRUD
Schema Design
Indexing
Replication
Sharding
Analytics
Monitoring
Backup and Recovery
Additional Topics
Introduction
What is
MongoDB?
MongoDB is...
NoSQL
Document-Oriented Database
Multi-platform
and Open-source
Why was
MongoDB built?
Big Data
Cloud Computing
Key Features
Flexibility
High Perfomance
High Availability
Scalable
Power
Easy to use
Hands On
- Download
-
Install
-
Connect
-
Shutdown
-
Mongo shell
-
Import data
"Momentum"
Mongo Shell
CRUD
You Know JavaScript?
for (i=0; i < 5; i++) {
print("hello from the mongo shell");
}
???
> use <dbname>
> db.stats()
> db.stats
> db. // press TAB
Relational Databases
Document Oriented
Terminology
Database == Database
Table == Collection
Row = Document
Column == Attribute
JSON
{
"name" : "Michel",
"registered" : true,
languages : [ "c#", "python", "ruby" ],
"address" : {
"city" : "Londrina",
"state" : "PR"
"country" : "Brasil"
},
created_on : new Date()
}
BSON
Hands On
- Insert
- Query
- Projection
- Cursor
-
Update
-
Remove
Schema Design
"Store your data the way your application wants to see it"
Keep in mind
16mb per document
One to One?
One to Many?
Many to Many?
Hands On
-
Ecommerce Design
Indexing
MongoDB
is very FAST
But...
Index Types
_id Index
Secondary Index
Compound Index
Multikey Index
Geospatial Index
Hands On
- explain()
- Create index
- sparse
- unique
- dropDups
- background
- '2d'
Replication
High Availability
Failover
Read Scalability
Hands On
-
Create Replica Set Cluster
Sharding
Scalability
No joins
No transactions
Horizontal Scalability
Hands On
-
Create Shard Cluster
Analitycs
Aggregation
Framework
db.products.aggregate([
{$group:
{
_id: {
"maker":"$manufacturer"
},
max_price:{$max:"$price"}
}
}
])
Hands On
- $match
- $group
- $project
- $unwind
- $avg
- $sum
- $sort
-
$limit
Monitoring
MMS
MongoDB Monitoring Services (10gen)
MMS
MongoDB Monitoring Services (10gen)
Benchmark
Hands On
-
mongostat
-
mongotop
-
profilling
Backup and
Recovery
Scenario 1
Single Server / Replica Set
Mongo / Mongo
Copy data manually
mongodump
mongorestore
MongoDB / Other Sources
mongoimport
mongoexport
Scenario 2
Sharding
MongoDB Backup Service (10gen)
Hands On
- Dump
- Restore
-
Import data (csv)
Additional Topics
Security
MongoDB SSL
MongoDB Gazzang
Authentication (Basic, Kerberos)
Roles
GridFS
File Storage
Photos, Videos, Documents, etc
case:
Drivers
C#
C++
Java
Ruby
Python
Node.js
Erlang
Pearl
Hands On
-
C# and MongoDB
-
Python and MongoDB
Introduccion MongoDB
By gerson231294
Introduccion MongoDB
- 796