an introduction to mongodb by césar trigo #openexpoday 2014
DESCRIPTION
An introduction to MongoDB by César Trigo #OpenExpoDay 2014TRANSCRIPT
César Trigo EstebanBackend Development DirectorTwitter: @CesarTrigoEs
www.mongodbspain.comTwitter: @MongoDBSpain
An Introduction to
1 What is MongoDBOVERVIEW
World Wide leading NoSQL Databasethat allows companies to be more agile and scalable
1. Improving the customer experience
2. Allowing schemes to change quickly to adapt easily to changes
3. Enabling Big-Data
4. Accelerating time to market
5. Reducing costs
2 What is MongoDBWHO IS USING MONGODB
More at: www.mongodb.com/customers
3 What is MongoDBCOMMUNITY
7Million +Downloads
200k +Education Registrations
30k +MongoDB User Group Members
Fastest-growing community in Big Data
4 What is MongoDBDEFINITION
MongoDB is a ...
… database
❖ Open source
❖ Document oriented
❖ Non-relational & Schema-less
❖ Scalable
❖ High performance
❖ Full featured
4 What is MongoDBDEFINITION
MongoDB is a ...
… database
❖ Open source
❖ Document oriented
❖ Non-relational & Schema-less
❖ Scalable
❖ High performance
❖ Full featured
MongoDB Main FeaturesOPEN SOURCE
Source and supported drivers are open source and hosted at Github:
https://github.com/mongodb
Supported drivers for most programming languages
4.1
What is MongoDBDEFINITION
MongoDB is a ...
… database
❖ Open source
❖ Document oriented
❖ Non-relational & Schema-less
❖ High performance
❖ Scalable
❖ Full featured
5
5.1 MongoDB Main FeaturesDOCUMENT ORIENTED
● JSON-like format (BSON) documents as independent units
● Makes it easier to distribute data across multiple servers
● Natural object mapping due to JSON Objects
databasedatabase
collectiontable
documentrow
SQL Term MongoDB Term
SQL to MongoDB
fieldcolumn
embedding & linkingjoin
What is MongoDBDEFINITION
MongoDB is a ...
… database
❖ Open source
❖ Document oriented
❖ Non-relational & Schema-less
❖ Scalable
❖ High performance
❖ Full featured
6
MongoDB Main FeaturesNON-RELATIONAL & SCHEMA-LESS
User Hobbies
Addresses
Relational Databases (RDBMS) Data Model
6.1
MongoDB Main FeaturesNON-RELATIONAL & SCHEMA-LESS
User
Hobbies
Addresses
With MongoDB we can store related content in
the same document
Non-Relational Data Model
6.2
MongoDB Main FeaturesNON-RELATIONAL & SCHEMA-LESS
User Info- name - creation- nick - ...- age
Hobbies
Addresses
db.user.findOne();{
_id: objectId("535c56cbdf1790f4e1c80074"),name: "César Trigo",nick: "CesarTrigo",age: 25,creation: ISODate("2014-04-27T01:00:59.448Z"),hobbies: ["coding", "football", "basket"],address:[{
street: "Calle Serrano",number: 127,city: "Madrid"
},{
street: "Avenida Diagonal",city: "Barcelona"
}],}
coding basket
address address
MongoDB Document
6.3
football
MongoDB Main FeaturesNON-RELATIONAL & SCHEMA-LESS
User Info- name - creation- nick - ...- age
Hobbies
Addresses
db.user.findOne();{
_id: objectId("535c56cbdf1790f4e1c80074"),name: "César Trigo",nick: "CesarTrigo",age: 25,creation: ISODate("2014-04-27T01:00:59.448Z"),hobbies: ["coding", "football", "basket"],address:[{
street: "Calle Serrano",number: 127,city: "Madrid"
},{
street: "Avenida Diagonal",city: "Barcelona"
}],}
coding basket
address address
MongoDB Document
6.3
football
MongoDB Main FeaturesNON-RELATIONAL & SCHEMA-LESS
User Info- name - creation- nick - ...- age
Hobbies
Addresses
db.user.findOne();{
_id: objectId("535c56cbdf1790f4e1c80074"),name: "César Trigo",nick: "CesarTrigo",age: 25,creation: ISODate("2014-04-27T01:00:59.448Z"),hobbies: ["coding", "football", "basketball"],address:[{
street: "Calle Serrano",number: 127,city: "Madrid"
},{
street: "Avenida Diagonal",city: "Barcelona"
}],}
coding footbal basket
address address
MongoDB Document
6.3
What is MongoDBDEFINITION
MongoDB is a ...
… database
❖ Open source
❖ Document oriented
❖ Non-relational & Schema-less
❖ Scalable
❖ High performance
❖ Full featured
7
MongoDB Main FeaturesSCALABLE
Replication: provides redundancy and high data availability
Primary
Secondary
Secondary
DRIVER
APP
write
readAsynchronousReplication
● Automated replication and failover
● Multi-datacenter support
● Data durability and consistency
7.1
MongoDB Main FeaturesSCALABLE
Sharding: Storing data records across multiple machines to meeting the demands of data growth
Shard 1 Shard 2 Shard 3 Shard N
● Increase capacity as you grow reducing the amount of data that each server needs to store
● Reduces the number of operations each shard handles
● Automatic balancing of data
...
7.2
MongoDB Main FeaturesSCALABLE INFRASTRUCTURE
Application
Driver
Query Router Query Router
Primary
Secondary
Secondary
Primary
Secondary
Secondary
Primary
Secondary
Secondary
Primary
Secondary
Secondary
Shard 1 Shard 2 Shard 3 Shard N
...
...
7.3
What is MongoDBDEFINITION
MongoDB is a ...
… database
❖ Open source
❖ Document oriented
❖ Non-relational & Schema-less
❖ Scalable
❖ High performance
❖ Full featured
8
MongoDB Main FeaturesHIGH PERFORMANCE
vs
Better data locality In-memory caching Atomic operations
8.1
Relational MongoDB
MongoDB Main FeaturesHIGH PERFORMANCE
Driver
Secondary
Secondary
Write Concern: customizable write concerns for Replica Sets
Primary
write
replicate
replicate
respo
nse
apply
apply
Write operation to a replica set
Write to the primary and at least one secondary
8.2
What is MongoDBDEFINITION
MongoDB is a ...
… database
❖ Open source
❖ Document oriented
❖ Non-relational & Schema-less
❖ Scalable
❖ High performance
❖ Full featured
9
● Geospatial indexes to support geographic data structures
● GeoJSON support
● 2d support for Flat / Euclidean plane distance calculation
MongoDB Main FeaturesFULL FEATURED
Geospatial features
9.2
A solution for the real Worldbecause the Earth is not flat!
2d Sphere Indexes: provides spherical geometry support for Earth-like sphere
distance calculation
MongoDB Main FeaturesFULL FEATURED9.2
MongoDB Main FeaturesFULL FEATURED9.3
MongoDB Main FeaturesFULL FEATURED
Real time Aggregation: Aggregations are operations that process data records and return computed results
9.3
Aggregation Pipelines
The pipeline provides efficient data aggregation using native operations within MongoDB
Map-Reduce
Uses custom JavaScript functions to perform the map and reduce operations, as well as the optional finalize operation.
MongoDB Main FeaturesFULL FEATURED
MongoDB Management Service
● Server status monitoring
● Custom, metric-based alerting
● Fully managed backups
● Activity and logging viewers
● Automation coming soon
9.4
[email protected]@CesarTrigoEs
@MongoDBSpain
MongoDB Spain www.mongodbspain.com
www.gigigo.com
César Trigo EstebanBackend Development Director