SlideShare a Scribd company logo
1 of 30
Download to read offline
Database NoSql 
Document Oriented 
Matteo Merola
Cosa sono 
Programmi ideati per memorizzare, reperire e gestire 
informazioni semi-strutturate 
Nessuno schema Gestione scalabile
Documento 
Incapsulamento Codifica
Documento 
Incapsulamento Codifica 
<user> 
<name>Matteo</name> 
<address>Via 
G. 
Mazzini, 
5</address> 
<hobby>Pesca</hobby> 
</user> 
Esempio
Documento 
{ 
"author": 
“Matteo 
Merola", 
"text": 
"Oggi 
presentazione 
document-­‐oriented 
DB 
;)", 
"comments": 
[ 
{ 
"author": 
“Giovanni 
Grano", 
"text": 
"ci 
sarò!", 
"replies": 
[ 
{ 
"author": 
“Carlo 
Branca", 
"text": 
"anche 
io..." 
} 
] 
}, 
{ 
"author": 
“Simone 
Scalabrino", 
"text": 
"ci 
vediamo 
lì", 
"replies": 
[] 
} 
] 
} 
Un post su facebook
Principali database 
Document Oriented
Principali database 
Document Oriented
MongoDB 
Codifica! 
JSON (BSON) 
Performance! 
scritto in C++ 
supporto pieno all’indicizzazione 
operazioni atomiche 
file mappati in memoria (scritture 
ritardate) 
Scalabilità! 
replicazione 
sharding 
Supporto commerciale! 
…tanta documentazione
Altre feature di 
MongoDB 
Query basate sul 
documento! 
linguaggio di 
interrogazione flessibile 
basato su JSON/Javascript 
! 
MapReduce! 
aggregazione flessibile 
GridFS! 
memorizza file di qualsiasi 
dimensione facilmente
Altre feature di 
MongoDB 
Query basate sul 
documento! 
linguaggio di 
interrogazione flessibile 
basato su JSON/Javascript 
! 
MapReduce! 
aggregazione flessibile 
GridFS! 
memorizza file di qualsiasi 
dimensione facilmente
Multipiattaforma 
facile installazione
Multipiattaforma 
facile installazione 
http://docs.mongodb.org/manual/
MongoDB: concetti base
MongoDB: concetti base 
Documento! 
analogia con una riga dei 
RDBMS 
rappresentazione tramite JSON 
(BSON) 
annidamento 
può referenziare altri 
documenti 
Collection! 
analogia con una tabella dei 
RDBMS 
collezione di documenti 
i documenti possono essere 
di diverso tipo ma… 
…se sono simili i vantaggi 
aumentano
MongoDB: concetti base 
Incapsulamento! 
analogia con una chiave 
esterna nei RDBMS 
relazioni unite senza uso 
di join 
modello concettuale più 
chiaro 
Collection posts 
{ 
"author": 
ObjectId(“53b9884344069471a1f19f05c5”), 
"text": 
“Un 
post", 
"comments": 
[ 
{ 
"author": 
ObjectId(“53b9884344069471a1h142356”), 
"text": 
“Un 
commento”, 
"replies": 
[ 
{ 
"author": 
ObjectId(“53b9884344069471a1f19f05c5”), 
"text": 
“Una 
risposta" 
} 
] 
} 
] 
} 
Collection authors 
{ 
{ 
“_id": 
ObjectId(“53b9884344069471a1f19f05c5”), 
"name": 
“Matteo 
Merola" 
} 
“_id": 
ObjectId(“53b9884344069471a1h142356”), 
"name": 
“Carlo 
Branca" 
}
Query Developer-friendly * 
* dipende dallo sviluppatore
MongoDB: operazioni base 
Mongo 
SQL
MongoDB: operazioni base 
Inserimento di un documento 
Mongo 
SQL
MongoDB: operazioni base 
Modifica di un documento 
Mongo 
SQL
MongoDB: operazioni base 
Eliminazione di un documento 
Mongo 
SQL
Demo
Replicazione 
Scopo! 
ridondanza 
disponibilità del 
dato 
disaster recovery 
Modalità! 
tipica Master/Slave 
ma con Failover 
automatico
Sharding 
Partizionamento! 
i dati sono distribuiti su più 
macchine 
Big Data! 
alta quantità di dati 
memorizzabili 
Alto throughput! 
Scaling orizzontale! 
più potente e meno costoso 
dello scaling verticale
Bilanciamento 
Splitting 
Migration
Sharding 
Come funziona?
Sharding
Quando usare i DB document-oriented? 
Dati strutturati Dati NON strutturati
Polyglot Persistence 
2008, Scott Leberknight “Polyglot Persistence”
“The rise of NoSQL databases marks the end of 
the era of relational database dominance. The 
era of Polyglot Persistence has begun.” 
–Martin Fowler, November 2011.
Università degli Studi di Salerno Scarica questa presentazione 
Matteo Merola 
mattmezza@gmail.com 
Università degli Studi di Salerno

More Related Content

What's hot

Back to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQLBack to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQLMongoDB
 
Back to Basics, webinar 5: Introduzione ad Aggregation Framework
Back to Basics, webinar 5: Introduzione ad Aggregation FrameworkBack to Basics, webinar 5: Introduzione ad Aggregation Framework
Back to Basics, webinar 5: Introduzione ad Aggregation FrameworkMongoDB
 
Back to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioBack to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioMongoDB
 
Deploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web ServicesDeploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web ServicesStefano Dindo
 
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLBack to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLMongoDB
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009Massimiliano Dessì
 
MongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework MeetingMongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework Meetingguest67beeb9
 
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)MongoDB
 
MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009Massimiliano Dessì
 
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDBAdvanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDBLuca Marignati
 
Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...
Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...
Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...MongoDB
 
Javascript - 4 | WebMaster & WebDesigner
Javascript - 4 | WebMaster & WebDesignerJavascript - 4 | WebMaster & WebDesigner
Javascript - 4 | WebMaster & WebDesignerMatteo Magni
 
Abusing HTML 5 Client-side Storage
Abusing HTML 5 Client-side StorageAbusing HTML 5 Client-side Storage
Abusing HTML 5 Client-side Storageameft
 

What's hot (13)

Back to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQLBack to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQL
 
Back to Basics, webinar 5: Introduzione ad Aggregation Framework
Back to Basics, webinar 5: Introduzione ad Aggregation FrameworkBack to Basics, webinar 5: Introduzione ad Aggregation Framework
Back to Basics, webinar 5: Introduzione ad Aggregation Framework
 
Back to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioBack to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizio
 
Deploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web ServicesDeploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web Services
 
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLBack to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009
 
MongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework MeetingMongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework Meeting
 
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
 
MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009
 
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDBAdvanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDB
 
Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...
Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...
Creating Highly-Available MongoDB Microservices with Docker Containers and Ku...
 
Javascript - 4 | WebMaster & WebDesigner
Javascript - 4 | WebMaster & WebDesignerJavascript - 4 | WebMaster & WebDesigner
Javascript - 4 | WebMaster & WebDesigner
 
Abusing HTML 5 Client-side Storage
Abusing HTML 5 Client-side StorageAbusing HTML 5 Client-side Storage
Abusing HTML 5 Client-side Storage
 

Viewers also liked

How to call $scope function from console
How to call $scope function from consoleHow to call $scope function from console
How to call $scope function from consolecodeandyou forums
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
NoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove SoluzioniNoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove SoluzioniSteve Maraspin
 
Power BI Streaming Datasets
Power BI Streaming DatasetsPower BI Streaming Datasets
Power BI Streaming DatasetsGreg McMurray
 
Data Analytics and Distribution with Power BI
 Data Analytics and Distribution with Power BI Data Analytics and Distribution with Power BI
Data Analytics and Distribution with Power BIdesertislesql
 
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groupsUnbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groupsIsabelle Van Campenhoudt
 
SharePoint 2016 The Future is Hybrid, what you need to know about it
SharePoint 2016 The Future is Hybrid, what you need to know about itSharePoint 2016 The Future is Hybrid, what you need to know about it
SharePoint 2016 The Future is Hybrid, what you need to know about itKnut Relbe-Moe [MVP, MCT]
 
Microsoft PowerPivot & Power View in Excel 2013
Microsoft PowerPivot & Power View in Excel 2013Microsoft PowerPivot & Power View in Excel 2013
Microsoft PowerPivot & Power View in Excel 2013Mark Ginnebaugh
 
What is Power BI
What is Power BIWhat is Power BI
What is Power BIDries Vyvey
 
Power BI Create lightning fast dashboard with power bi & Its Components
Power BI Create lightning fast dashboard with power bi & Its Components Power BI Create lightning fast dashboard with power bi & Its Components
Power BI Create lightning fast dashboard with power bi & Its Components Vishal Pawar
 
Design for Humans - Tech Vision 2017 Trend 4
Design for Humans - Tech Vision 2017 Trend 4Design for Humans - Tech Vision 2017 Trend 4
Design for Humans - Tech Vision 2017 Trend 4Accenture Technology
 
The Uncharted - Tech Vision 2017 Trend 5
The Uncharted - Tech Vision 2017 Trend 5The Uncharted - Tech Vision 2017 Trend 5
The Uncharted - Tech Vision 2017 Trend 5Accenture Technology
 
Learn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&A
Learn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&ALearn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&A
Learn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&AVishal Pawar
 
Microsoft Power BI Overview
Microsoft Power BI OverviewMicrosoft Power BI Overview
Microsoft Power BI OverviewNetwoven Inc.
 
Top 10 Cloud Trends for 2017
Top 10 Cloud Trends for 2017Top 10 Cloud Trends for 2017
Top 10 Cloud Trends for 2017Tableau Software
 
Power BI Made Simple
Power BI Made SimplePower BI Made Simple
Power BI Made SimpleJames Serra
 
State of Digital Transformation 2016. Altimeter Report
State of Digital Transformation 2016. Altimeter ReportState of Digital Transformation 2016. Altimeter Report
State of Digital Transformation 2016. Altimeter ReportDen Reymer
 
Ecosystem Power Plays - Tech Vision 2017 Trend 2
Ecosystem Power Plays - Tech Vision 2017 Trend 2Ecosystem Power Plays - Tech Vision 2017 Trend 2
Ecosystem Power Plays - Tech Vision 2017 Trend 2Accenture Technology
 

Viewers also liked (20)

How to call $scope function from console
How to call $scope function from consoleHow to call $scope function from console
How to call $scope function from console
 
Schema Design
Schema DesignSchema Design
Schema Design
 
NoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove SoluzioniNoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
NoSQL, No Worries: Vecchi Problemi, Nuove Soluzioni
 
Power BI Streaming Datasets
Power BI Streaming DatasetsPower BI Streaming Datasets
Power BI Streaming Datasets
 
Data Analytics and Distribution with Power BI
 Data Analytics and Distribution with Power BI Data Analytics and Distribution with Power BI
Data Analytics and Distribution with Power BI
 
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groupsUnbreakable Sharepoint 2016 With SQL Server 2016 availability groups
Unbreakable Sharepoint 2016 With SQL Server 2016 availability groups
 
SharePoint 2016 The Future is Hybrid, what you need to know about it
SharePoint 2016 The Future is Hybrid, what you need to know about itSharePoint 2016 The Future is Hybrid, what you need to know about it
SharePoint 2016 The Future is Hybrid, what you need to know about it
 
Microsoft PowerPivot & Power View in Excel 2013
Microsoft PowerPivot & Power View in Excel 2013Microsoft PowerPivot & Power View in Excel 2013
Microsoft PowerPivot & Power View in Excel 2013
 
What is Power BI
What is Power BIWhat is Power BI
What is Power BI
 
Power BI Overview
Power BI OverviewPower BI Overview
Power BI Overview
 
Power BI Create lightning fast dashboard with power bi & Its Components
Power BI Create lightning fast dashboard with power bi & Its Components Power BI Create lightning fast dashboard with power bi & Its Components
Power BI Create lightning fast dashboard with power bi & Its Components
 
Design for Humans - Tech Vision 2017 Trend 4
Design for Humans - Tech Vision 2017 Trend 4Design for Humans - Tech Vision 2017 Trend 4
Design for Humans - Tech Vision 2017 Trend 4
 
Power BI
Power BIPower BI
Power BI
 
The Uncharted - Tech Vision 2017 Trend 5
The Uncharted - Tech Vision 2017 Trend 5The Uncharted - Tech Vision 2017 Trend 5
The Uncharted - Tech Vision 2017 Trend 5
 
Learn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&A
Learn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&ALearn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&A
Learn Power BI with Power Pivot, Power Query, Power View, Power Map and Q&A
 
Microsoft Power BI Overview
Microsoft Power BI OverviewMicrosoft Power BI Overview
Microsoft Power BI Overview
 
Top 10 Cloud Trends for 2017
Top 10 Cloud Trends for 2017Top 10 Cloud Trends for 2017
Top 10 Cloud Trends for 2017
 
Power BI Made Simple
Power BI Made SimplePower BI Made Simple
Power BI Made Simple
 
State of Digital Transformation 2016. Altimeter Report
State of Digital Transformation 2016. Altimeter ReportState of Digital Transformation 2016. Altimeter Report
State of Digital Transformation 2016. Altimeter Report
 
Ecosystem Power Plays - Tech Vision 2017 Trend 2
Ecosystem Power Plays - Tech Vision 2017 Trend 2Ecosystem Power Plays - Tech Vision 2017 Trend 2
Ecosystem Power Plays - Tech Vision 2017 Trend 2
 

Database NoSql Document Oriented - MongoDB

  • 1. Database NoSql Document Oriented Matteo Merola
  • 2. Cosa sono Programmi ideati per memorizzare, reperire e gestire informazioni semi-strutturate Nessuno schema Gestione scalabile
  • 4. Documento Incapsulamento Codifica <user> <name>Matteo</name> <address>Via G. Mazzini, 5</address> <hobby>Pesca</hobby> </user> Esempio
  • 5. Documento { "author": “Matteo Merola", "text": "Oggi presentazione document-­‐oriented DB ;)", "comments": [ { "author": “Giovanni Grano", "text": "ci sarò!", "replies": [ { "author": “Carlo Branca", "text": "anche io..." } ] }, { "author": “Simone Scalabrino", "text": "ci vediamo lì", "replies": [] } ] } Un post su facebook
  • 8. MongoDB Codifica! JSON (BSON) Performance! scritto in C++ supporto pieno all’indicizzazione operazioni atomiche file mappati in memoria (scritture ritardate) Scalabilità! replicazione sharding Supporto commerciale! …tanta documentazione
  • 9. Altre feature di MongoDB Query basate sul documento! linguaggio di interrogazione flessibile basato su JSON/Javascript ! MapReduce! aggregazione flessibile GridFS! memorizza file di qualsiasi dimensione facilmente
  • 10. Altre feature di MongoDB Query basate sul documento! linguaggio di interrogazione flessibile basato su JSON/Javascript ! MapReduce! aggregazione flessibile GridFS! memorizza file di qualsiasi dimensione facilmente
  • 12. Multipiattaforma facile installazione http://docs.mongodb.org/manual/
  • 14. MongoDB: concetti base Documento! analogia con una riga dei RDBMS rappresentazione tramite JSON (BSON) annidamento può referenziare altri documenti Collection! analogia con una tabella dei RDBMS collezione di documenti i documenti possono essere di diverso tipo ma… …se sono simili i vantaggi aumentano
  • 15. MongoDB: concetti base Incapsulamento! analogia con una chiave esterna nei RDBMS relazioni unite senza uso di join modello concettuale più chiaro Collection posts { "author": ObjectId(“53b9884344069471a1f19f05c5”), "text": “Un post", "comments": [ { "author": ObjectId(“53b9884344069471a1h142356”), "text": “Un commento”, "replies": [ { "author": ObjectId(“53b9884344069471a1f19f05c5”), "text": “Una risposta" } ] } ] } Collection authors { { “_id": ObjectId(“53b9884344069471a1f19f05c5”), "name": “Matteo Merola" } “_id": ObjectId(“53b9884344069471a1h142356”), "name": “Carlo Branca" }
  • 16. Query Developer-friendly * * dipende dallo sviluppatore
  • 18. MongoDB: operazioni base Inserimento di un documento Mongo SQL
  • 19. MongoDB: operazioni base Modifica di un documento Mongo SQL
  • 20. MongoDB: operazioni base Eliminazione di un documento Mongo SQL
  • 21. Demo
  • 22. Replicazione Scopo! ridondanza disponibilità del dato disaster recovery Modalità! tipica Master/Slave ma con Failover automatico
  • 23. Sharding Partizionamento! i dati sono distribuiti su più macchine Big Data! alta quantità di dati memorizzabili Alto throughput! Scaling orizzontale! più potente e meno costoso dello scaling verticale
  • 27. Quando usare i DB document-oriented? Dati strutturati Dati NON strutturati
  • 28. Polyglot Persistence 2008, Scott Leberknight “Polyglot Persistence”
  • 29. “The rise of NoSQL databases marks the end of the era of relational database dominance. The era of Polyglot Persistence has begun.” –Martin Fowler, November 2011.
  • 30. Università degli Studi di Salerno Scarica questa presentazione Matteo Merola mattmezza@gmail.com Università degli Studi di Salerno