SlideShare uma empresa Scribd logo
1 de 19
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 ?

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Mais de 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?
 

Último

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Último (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

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 ?