SlideShare a Scribd company logo
1 of 19
Download to read offline
Wojciech Sznapka 13.05.2011 MongoDB – document oriented databaseDoes NoSQL make sense?
Agenda NoSQL – definition and solutions, MongoDB – description and feautres, MongoDB usage, Who uses it? Schema-free, Some live examples, Does NoSQL make sense?
NoSQL It’s a class of database management systems, the alternative for relational databases (RDBM). Sometimes people call they „next generation databases”, NoSQL databases haven’t got schema like relational systems, there’s no table joining and have good scalling facilities.
NoSQL solutions Document oriented: MongoDB Apache CouchDB Key Value storage: Big Table (Google App Engine) Dynamo (Amazon Web Services) Apache Cassandra (Facebook) Project Voldemort (LinkedIn)
MongoDB Document Oriented – stores JSON documetns , Very efficient (written in C++), High scallable, Schema-free – high flexibility, Supports many software platform and has plenty programming language drivers (PHP, .NET, Java, Python, Ruby, etc.), Developping since August 2007, first release in 2009, Open Source (GNU AGPL).
MongoDB features Stores dynamic JSON documents (internally represented as BSON – Binary JSON), Full support for indicies, Replication and high availability, Complex queries (which are also represented as JSONs), Map/Reduce mechanism – handy way of aggregation and processing data (combination of SQL’s Group By and stored procedures), GridFS – mongo’s file system, which allows to store files in database.
Where it applies? Web appliactions (logging, caching, processing huge amount of data), High load / high scalabillity, GIS solutions (it supports 2d geospatial indicies – longitude/latitude) Where it shouldn’t be used? High transactional operations (no support for ACID principle), Cases which needs SQL (many joins for example)
Who uses it?
MongoDB vs. SQL
Schema-free – no migrations! MongoDB (as every NoSQL solution) is schema-free, so if we need to put new field into existing document, we don’t need to do extra things, like Alter Table in SQL database. We just start using document with new field, It means, that we don’t need to care about an migrations – it’s done transparently.
Examples Document, Aggregated document, Sorting, limiting, Advanced  searching (including regexp), PHP code.
CRUD on Documents > db.foo.insert({name: "Wojciech", age: 25, tags: ["male", "developer"]}) > db.foo.insert({name: "Andreea", tags: ["female", "rt master"]}) > db.foo.insert({name: "Okky", tags: ["male", "developer"]}) > db.foo.update({name: "Wojciech"}, {$set: {surname: "Sznapka"}}) > db.foo.remove({name: "Okky"}); > db.foo.find() { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] } { "_id" : ObjectId("4dcd13ce7ffde8d258900f7c"), "name" : "Okky", "tags" : [ "male", "developer" ] } { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "age" : 25, "name" : "Wojciech", "surname" : "Sznapka", "tags" : [ "male", "developer" ] } > db.foo.find({tags: "rt master"}) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] }
Aggregated documents > db.logs.insert({msg: "error occured", details: {line: 2, severity: 3}}) > db.logs.insert({msg: "user logged in", details: {severity: 10}}) >  db.logs.find({'details.severity': 10}) { "_id" : ObjectId("4dcd15d77ffde8d258900f7e"), "msg" : "user logged in", "details" : { "severity" : 10 } }
Sorting and limiting > db.foo.find({}, {name: 1}).sort({name: -1}) { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "name" : "Wojciech" } { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea" } > db.foo.find().limit(1) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] }
Sorting and limiting > db.foo.find({}, {name: 1}).sort({name: -1}) { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "name" : "Wojciech" } { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea" } > db.foo.find().limit(1) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] }
Advanced queries >  db.foo.find({tags: "developer", age: {$exists: true}}) { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "age" : 25, "name" : "Wojciech", "surname" : "Sznapka", "tags" : [ "male", "developer" ] } >  db.foo.find({name: /a$/}, {name: 1}) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea" } { "_id" : ObjectId("4dcd17ae7ffde8d258900f80"), "name" : "Tamara" }
PHP example <?php $mongo = new Mongo(); $db = $mongo->foo; $collection = $db->foo; $wojtek = array("name" => "Wojciech", "tags" => array("male", "developer"), "age" => 25); $okky   = array("name" => "Okky",     "tags" => array("male", "developer")); $collection->insert($wojtek); $collection->insert($okky); $cursor = $collection->find(); foreach ($cursor as $document) {     printf("Name: %s", $document["name"]); }
Does NoSQL make sense? Yes, if we will use NoSQL databases along with SQL, if they are needed. Dropping SQL databases completly isn’t the best idea for huge and complicated applications, but supplementing data model with NoSQL database (like MongoDB), can improve application performance and shorten development process, It should be rather „Not onyl SQL”.
Thank you for an attention Any questions ?

More Related Content

What's hot

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMike Dirolf
 
MongoDB for Beginners
MongoDB for BeginnersMongoDB for Beginners
MongoDB for BeginnersEnoch Joshua
 
MongoDB : The Definitive Guide
MongoDB : The Definitive GuideMongoDB : The Definitive Guide
MongoDB : The Definitive GuideWildan Maulana
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Dbchriskite
 
Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLMongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNodeXperts
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNosh Petigara
 
Webinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsWebinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsMongoDB
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDBAlex Sharp
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & IntroductionJerwin Roy
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
 

What's hot (20)

Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
MongoDB for Beginners
MongoDB for BeginnersMongoDB for Beginners
MongoDB for Beginners
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
MongoDB : The Definitive Guide
MongoDB : The Definitive GuideMongoDB : The Definitive Guide
MongoDB : The Definitive Guide
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Db
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB - Ekino PHP
MongoDB - Ekino PHPMongoDB - Ekino PHP
MongoDB - Ekino PHP
 
Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQL
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mondodb
MondodbMondodb
Mondodb
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Webinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsWebinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in Documents
 
Mongo db workshop # 02
Mongo db workshop # 02Mongo db workshop # 02
Mongo db workshop # 02
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB Application
 

Similar to Mongo db – document oriented database

DrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and DrupalDrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and DrupalDoug Green
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBantoinegirbal
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introductionantoinegirbal
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo dbMongoDB
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...NoSQLmatters
 
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardJAX London
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_dbRomain Testard
 
Schema design short
Schema design shortSchema design short
Schema design shortMongoDB
 
Json to hive_schema_generator
Json to hive_schema_generatorJson to hive_schema_generator
Json to hive_schema_generatorPayal Jain
 
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...Codemotion
 
NoSQL: what's under the hood?
NoSQL: what's under the hood? NoSQL: what's under the hood?
NoSQL: what's under the hood? Aleksey Solntsev
 
Introducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop seriesIntroducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop seriesHolden Karau
 
Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JSHamdi Hmidi
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App ArchitectureCorey Butler
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Guillaume Laforge
 

Similar to Mongo db – document oriented database (20)

DrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and DrupalDrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and Drupal
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo db
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
 
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_db
 
MongoDB
MongoDBMongoDB
MongoDB
 
Schema design short
Schema design shortSchema design short
Schema design short
 
Json to hive_schema_generator
Json to hive_schema_generatorJson to hive_schema_generator
Json to hive_schema_generator
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
 
NoSQL: what's under the hood?
NoSQL: what's under the hood? NoSQL: what's under the hood?
NoSQL: what's under the hood?
 
Introducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop seriesIntroducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop series
 
jQuery
jQueryjQuery
jQuery
 
Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JS
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App Architecture
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
 

More from Wojciech Sznapka

Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and mythsWojciech Sznapka
 
Smart development environments
Smart development environmentsSmart development environments
Smart development environmentsWojciech Sznapka
 
Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...
Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...
Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...Wojciech Sznapka
 
MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?
MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?
MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?Wojciech Sznapka
 

More from Wojciech Sznapka (6)

Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and myths
 
Smart development environments
Smart development environmentsSmart development environments
Smart development environments
 
Symfony2 w chmurze
Symfony2 w chmurzeSymfony2 w chmurze
Symfony2 w chmurze
 
Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...
Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...
Łebski Development czyli kiedy i dlaczego tworzyć oprogramowanie pod klucz i ...
 
Symfony2 showcase
Symfony2 showcaseSymfony2 showcase
Symfony2 showcase
 
MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?
MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?
MongoDB - baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?
 

Recently uploaded

Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Recently uploaded (20)

Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

Mongo db – document oriented database

  • 1. Wojciech Sznapka 13.05.2011 MongoDB – document oriented databaseDoes NoSQL make sense?
  • 2. Agenda NoSQL – definition and solutions, MongoDB – description and feautres, MongoDB usage, Who uses it? Schema-free, Some live examples, Does NoSQL make sense?
  • 3. NoSQL It’s a class of database management systems, the alternative for relational databases (RDBM). Sometimes people call they „next generation databases”, NoSQL databases haven’t got schema like relational systems, there’s no table joining and have good scalling facilities.
  • 4. NoSQL solutions Document oriented: MongoDB Apache CouchDB Key Value storage: Big Table (Google App Engine) Dynamo (Amazon Web Services) Apache Cassandra (Facebook) Project Voldemort (LinkedIn)
  • 5. MongoDB Document Oriented – stores JSON documetns , Very efficient (written in C++), High scallable, Schema-free – high flexibility, Supports many software platform and has plenty programming language drivers (PHP, .NET, Java, Python, Ruby, etc.), Developping since August 2007, first release in 2009, Open Source (GNU AGPL).
  • 6. MongoDB features Stores dynamic JSON documents (internally represented as BSON – Binary JSON), Full support for indicies, Replication and high availability, Complex queries (which are also represented as JSONs), Map/Reduce mechanism – handy way of aggregation and processing data (combination of SQL’s Group By and stored procedures), GridFS – mongo’s file system, which allows to store files in database.
  • 7. Where it applies? Web appliactions (logging, caching, processing huge amount of data), High load / high scalabillity, GIS solutions (it supports 2d geospatial indicies – longitude/latitude) Where it shouldn’t be used? High transactional operations (no support for ACID principle), Cases which needs SQL (many joins for example)
  • 10. Schema-free – no migrations! MongoDB (as every NoSQL solution) is schema-free, so if we need to put new field into existing document, we don’t need to do extra things, like Alter Table in SQL database. We just start using document with new field, It means, that we don’t need to care about an migrations – it’s done transparently.
  • 11. Examples Document, Aggregated document, Sorting, limiting, Advanced searching (including regexp), PHP code.
  • 12. CRUD on Documents > db.foo.insert({name: "Wojciech", age: 25, tags: ["male", "developer"]}) > db.foo.insert({name: "Andreea", tags: ["female", "rt master"]}) > db.foo.insert({name: "Okky", tags: ["male", "developer"]}) > db.foo.update({name: "Wojciech"}, {$set: {surname: "Sznapka"}}) > db.foo.remove({name: "Okky"}); > db.foo.find() { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] } { "_id" : ObjectId("4dcd13ce7ffde8d258900f7c"), "name" : "Okky", "tags" : [ "male", "developer" ] } { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "age" : 25, "name" : "Wojciech", "surname" : "Sznapka", "tags" : [ "male", "developer" ] } > db.foo.find({tags: "rt master"}) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] }
  • 13. Aggregated documents > db.logs.insert({msg: "error occured", details: {line: 2, severity: 3}}) > db.logs.insert({msg: "user logged in", details: {severity: 10}}) > db.logs.find({'details.severity': 10}) { "_id" : ObjectId("4dcd15d77ffde8d258900f7e"), "msg" : "user logged in", "details" : { "severity" : 10 } }
  • 14. Sorting and limiting > db.foo.find({}, {name: 1}).sort({name: -1}) { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "name" : "Wojciech" } { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea" } > db.foo.find().limit(1) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] }
  • 15. Sorting and limiting > db.foo.find({}, {name: 1}).sort({name: -1}) { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "name" : "Wojciech" } { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea" } > db.foo.find().limit(1) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea", "tags" : [ "female", "rt master" ] }
  • 16. Advanced queries > db.foo.find({tags: "developer", age: {$exists: true}}) { "_id" : ObjectId("4dcd13647ffde8d258900f7a"), "age" : 25, "name" : "Wojciech", "surname" : "Sznapka", "tags" : [ "male", "developer" ] } > db.foo.find({name: /a$/}, {name: 1}) { "_id" : ObjectId("4dcd13b37ffde8d258900f7b"), "name" : "Andreea" } { "_id" : ObjectId("4dcd17ae7ffde8d258900f80"), "name" : "Tamara" }
  • 17. PHP example <?php $mongo = new Mongo(); $db = $mongo->foo; $collection = $db->foo; $wojtek = array("name" => "Wojciech", "tags" => array("male", "developer"), "age" => 25); $okky = array("name" => "Okky", "tags" => array("male", "developer")); $collection->insert($wojtek); $collection->insert($okky); $cursor = $collection->find(); foreach ($cursor as $document) { printf("Name: %s", $document["name"]); }
  • 18. Does NoSQL make sense? Yes, if we will use NoSQL databases along with SQL, if they are needed. Dropping SQL databases completly isn’t the best idea for huge and complicated applications, but supplementing data model with NoSQL database (like MongoDB), can improve application performance and shorten development process, It should be rather „Not onyl SQL”.
  • 19. Thank you for an attention Any questions ?