SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
nonSQL databases
     alexey gaziev
RDBMS


• Great for many apps
• Shortcomings
  • Scalability
  • Flexibility
Other DBMS

• Flat file
• Hierarchical
• Network
• Document-oriented
• Object-oriented
CAP Theorem

                                          Pick two

С             A                        • Consistency
                                       • Availability
    P                                  • Tolerance to network
                                          Partitions


    http://www.cs.berkeley.edu/~brewer/cs262b-2004/PODC-keynote.pdf
ACID & BASE

• Atomicity     • Basically Available
• Consistency   • Soft state
• Isolation     • Eventually consistent
• Durability
ACID vs. BASE
    ACID                      BASE
•   Strong consistency    •   Weak consistency

•   Isolation             •   Availability first

•   Focus on “commit”     •   Best effort

•   Nested transactions   •   Approximate answers

•   Availability?         •   Agressive (optimistic)

•   Conservative          •   Simpler!

•   Difficult evolution     •   Faster
    (schema)
                          •   Easier evolution
Scalability &                Intro
Performance
                memcached

                   Key/Values store




                                                RDBMS




                                      Depth of Functionality
Features
• Collection oriented storage: easy storage of object/
  JSON -style data
• Dynamic queries
• Full index support, including on inner objects and
  embedded arrays
• Query profiling
• Replication and fail-over support
• Efficient storage of binary data including large objects
  (e.g. photos and videos)
• Auto-sharding for cloud-level scalability (currently in
  alpha)
• Commercial support available
Great for

• Websites
• Caching
• High volume, low value
• High scalability
• Storage of program objects and json
Not as great for


• Highly transactional
• Ad-hoc business intelligence
• Problems requiring SQL
Installation
Collection

• Think table, but with no schema
• For grouping into smaller query sets (speed)
• Each top entity in your app would have its own
 collection (users, articles, etc.)

• Full index support
Document


• Stored in collection, think record or row
• Can have _id key that works like primary key in
 MySQL

• Two options for relationships: subdocument or
 db reference
Storage (BSON)

{ author: 'joe',
  created: Date('03-28-2009'),
  title: 'Yet another blog post',
  text: 'Here is the text...',
  tags: [ 'example', 'joe' ],
  comments: [ { author: 'jim', comment: 'I disagree' },
           { author: 'nancy', comment: 'Good post' }
  ]
}
Basics
$ bin/mongod &
$ bin/mongo
...
> use mydb
> j = { name: "mongo"};
{"name" : "mongo"}
> t = { x : 3 };
{ "x" : 3 }
> db.things.save(j);
> db.things.save(t);
> db.things.find();
in cursor for : DBQuery: example.things ->
{"name" : "mongo" , "_id" : "497cf60751712cf7758+dbb"}
{"x" : 3 , "_id" : "497cf61651712cf7758+dbc"}
>
Querying

•   db.collection.find({‘first_name’: ‘John’}) # finds all Johns

•   db.collection.find({‘first_name’: /^J/}) # regex

•   db.collection.find_first({‘_id’:1}) # finds first with _id of 1

•   db.collection.find({‘age’: {‘$gt’: 21}}) # finds possible drinkers

•   db.collection.find({‘author.first_name’:‘John’}) # subdocument

•   db.collection.find({$where:‘this.age >= 6 && this.age <= 18’})
Querying 2

•   $in, $nin, $all, $ne, $gt, $gte, $lt, $lte, $size, $where

•   :fields (like :select in active record)

•   :limit, :offset for pagination

•   :sort ascending or descending [[‘foo’, 1], [‘bar’, -1]]

•   count and group (uses map/reduce)
Dynamic querying
Ruby support

• mongo-ruby-driver
  • Pure Ruby, with optional C extension
• MongoRecord
  • ORM like functionality
• Other mappers
Ruby basics
• Connect:
  • db = Mongo.new.db(‘my-database’)
  • coll = db.collection(‘players’)
• Insert:
  • coll.insert (“name” => “mike”, “age” => ...
• Query:
  • coll.find (“age” => 35)
Grid FS


• File storage in MongoDB

• IO-like API for Ruby
Other cool stuff



• Capped collections
• Upserts
• Multikeys
Resources
• http://spitfiresky.com/blog/recap-of-my-sdruby-
 presentation-on-mongodb.html

• http://railstips.org/2009/6/3/what-if-a-key-
 value-store-mated-with-a-relational-database-
 system

• http://www.mongodb.org/display/DOCS/
 Production+Deployments

• http://www.mongohq.com/home
Resources 2


• http://api.mongodb.org/ruby/0.15.1/index.html
• http://www.engineyard.com/blog/2009/
 mongodb-a-light-in-the-darkness-key-value-
 stores-part-5

• http://queue.acm.org/detail.cfm?id=1394128
thanks!

Weitere ähnliche Inhalte

Was ist angesagt?

Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDBAlex Sharp
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)Uwe Printz
 
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)ITB2016 - NoSQL with mongodb and ColdFusion (CFML)
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)Ortus Solutions, Corp
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App ArchitectureCorey Butler
 
Accesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data PlatformAccesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data PlatformLuca Di Fino
 
Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0Jeremy Likness
 
MongoDB introduction
MongoDB introductionMongoDB introduction
MongoDB introductionEdward Yoon
 
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsMongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsSpringPeople
 
MongoDB and Ecommerce : A perfect combination
MongoDB and Ecommerce : A perfect combinationMongoDB and Ecommerce : A perfect combination
MongoDB and Ecommerce : A perfect combinationSteven Francia
 
SDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modellingSDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modellingKorea Sdec
 
Azure doc db (slideshare)
Azure doc db (slideshare)Azure doc db (slideshare)
Azure doc db (slideshare)David Green
 
Demystfying nosql databases
Demystfying nosql databasesDemystfying nosql databases
Demystfying nosql databasesMike King
 
Azure Storage Services - Part 01
Azure Storage Services - Part 01Azure Storage Services - Part 01
Azure Storage Services - Part 01Neeraj Kumar
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 

Was ist angesagt? (20)

Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
 
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)ITB2016 - NoSQL with mongodb and ColdFusion (CFML)
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App Architecture
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
Accesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data PlatformAccesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data Platform
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0
 
MongoDB introduction
MongoDB introductionMongoDB introduction
MongoDB introduction
 
Azure storage
Azure storageAzure storage
Azure storage
 
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsMongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
 
MongoDB and Ecommerce : A perfect combination
MongoDB and Ecommerce : A perfect combinationMongoDB and Ecommerce : A perfect combination
MongoDB and Ecommerce : A perfect combination
 
SDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modellingSDEC2011 NoSQL Data modelling
SDEC2011 NoSQL Data modelling
 
Mongo db operations_v2
Mongo db operations_v2Mongo db operations_v2
Mongo db operations_v2
 
Azure doc db (slideshare)
Azure doc db (slideshare)Azure doc db (slideshare)
Azure doc db (slideshare)
 
Demystfying nosql databases
Demystfying nosql databasesDemystfying nosql databases
Demystfying nosql databases
 
Azure Storage Services - Part 01
Azure Storage Services - Part 01Azure Storage Services - Part 01
Azure Storage Services - Part 01
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
No(Geo)SQL
No(Geo)SQLNo(Geo)SQL
No(Geo)SQL
 

Andere mochten auch

Inteligencias multiples
Inteligencias multiplesInteligencias multiples
Inteligencias multiplesemaus_33
 
Inteligencias multiples
Inteligencias multiplesInteligencias multiples
Inteligencias multiplesemaus_33
 
Lectura 5. las inteligencias multiples
Lectura 5. las inteligencias multiplesLectura 5. las inteligencias multiples
Lectura 5. las inteligencias multiplesRafael Quintero
 
Proyecto paleta de inteligencias multiples celula animal vs celula vegetal
Proyecto  paleta de inteligencias multiples celula animal vs celula vegetalProyecto  paleta de inteligencias multiples celula animal vs celula vegetal
Proyecto paleta de inteligencias multiples celula animal vs celula vegetalGines Ciudad-Real Núñez
 
Presentación inteligencias multiples
Presentación inteligencias multiplesPresentación inteligencias multiples
Presentación inteligencias multiplesMaria Sosapavon
 

Andere mochten auch (7)

Inteligencias multiples
Inteligencias multiplesInteligencias multiples
Inteligencias multiples
 
Inteligencias multiples
Inteligencias multiplesInteligencias multiples
Inteligencias multiples
 
Lectura 5. las inteligencias multiples
Lectura 5. las inteligencias multiplesLectura 5. las inteligencias multiples
Lectura 5. las inteligencias multiples
 
Proyecto paleta de inteligencias multiples celula animal vs celula vegetal
Proyecto  paleta de inteligencias multiples celula animal vs celula vegetalProyecto  paleta de inteligencias multiples celula animal vs celula vegetal
Proyecto paleta de inteligencias multiples celula animal vs celula vegetal
 
Presentación inteligencias multiples
Presentación inteligencias multiplesPresentación inteligencias multiples
Presentación inteligencias multiples
 
seguridad
seguridadseguridad
seguridad
 
Os Harris
Os HarrisOs Harris
Os Harris
 

Ähnlich wie MongoDB

Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLRichard Schneeman
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBSean Laurent
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataRoger Xia
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQLYan Cui
 
Oracle Week 2016 - Modern Data Architecture
Oracle Week 2016 - Modern Data ArchitectureOracle Week 2016 - Modern Data Architecture
Oracle Week 2016 - Modern Data ArchitectureArthur Gimpel
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsHabilelabs
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxRahul Borate
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxRahul Borate
 
No SQL : Which way to go? Presented at DDDMelbourne 2015
No SQL : Which way to go?  Presented at DDDMelbourne 2015No SQL : Which way to go?  Presented at DDDMelbourne 2015
No SQL : Which way to go? Presented at DDDMelbourne 2015Himanshu Desai
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Javasunnygleason
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsKorea Sdec
 
Big Data (NJ SQL Server User Group)
Big Data (NJ SQL Server User Group)Big Data (NJ SQL Server User Group)
Big Data (NJ SQL Server User Group)Don Demcsak
 

Ähnlich wie MongoDB (20)

Drop acid
Drop acidDrop acid
Drop acid
 
MongoDB
MongoDBMongoDB
MongoDB
 
Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQL
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
Oracle Week 2016 - Modern Data Architecture
Oracle Week 2016 - Modern Data ArchitectureOracle Week 2016 - Modern Data Architecture
Oracle Week 2016 - Modern Data Architecture
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
MongoDB SF Ruby
MongoDB SF RubyMongoDB SF Ruby
MongoDB SF Ruby
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
 
No sql Database
No sql DatabaseNo sql Database
No sql Database
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 
No SQL : Which way to go? Presented at DDDMelbourne 2015
No SQL : Which way to go?  Presented at DDDMelbourne 2015No SQL : Which way to go?  Presented at DDDMelbourne 2015
No SQL : Which way to go? Presented at DDDMelbourne 2015
 
NoSQL, which way to go?
NoSQL, which way to go?NoSQL, which way to go?
NoSQL, which way to go?
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Java
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and models
 
Big Data (NJ SQL Server User Group)
Big Data (NJ SQL Server User Group)Big Data (NJ SQL Server User Group)
Big Data (NJ SQL Server User Group)
 
NOsql Presentation.pdf
NOsql Presentation.pdfNOsql Presentation.pdf
NOsql Presentation.pdf
 

Kürzlich hochgeladen

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
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
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
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
 
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
 

Kürzlich hochgeladen (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
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
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
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
 
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
 

MongoDB

  • 1. nonSQL databases alexey gaziev
  • 2. RDBMS • Great for many apps • Shortcomings • Scalability • Flexibility
  • 3. Other DBMS • Flat file • Hierarchical • Network • Document-oriented • Object-oriented
  • 4. CAP Theorem Pick two С A • Consistency • Availability P • Tolerance to network Partitions http://www.cs.berkeley.edu/~brewer/cs262b-2004/PODC-keynote.pdf
  • 5. ACID & BASE • Atomicity • Basically Available • Consistency • Soft state • Isolation • Eventually consistent • Durability
  • 6. ACID vs. BASE ACID BASE • Strong consistency • Weak consistency • Isolation • Availability first • Focus on “commit” • Best effort • Nested transactions • Approximate answers • Availability? • Agressive (optimistic) • Conservative • Simpler! • Difficult evolution • Faster (schema) • Easier evolution
  • 7.
  • 8. Scalability & Intro Performance memcached Key/Values store RDBMS Depth of Functionality
  • 9. Features • Collection oriented storage: easy storage of object/ JSON -style data • Dynamic queries • Full index support, including on inner objects and embedded arrays • Query profiling • Replication and fail-over support • Efficient storage of binary data including large objects (e.g. photos and videos) • Auto-sharding for cloud-level scalability (currently in alpha) • Commercial support available
  • 10. Great for • Websites • Caching • High volume, low value • High scalability • Storage of program objects and json
  • 11. Not as great for • Highly transactional • Ad-hoc business intelligence • Problems requiring SQL
  • 13. Collection • Think table, but with no schema • For grouping into smaller query sets (speed) • Each top entity in your app would have its own collection (users, articles, etc.) • Full index support
  • 14. Document • Stored in collection, think record or row • Can have _id key that works like primary key in MySQL • Two options for relationships: subdocument or db reference
  • 15. Storage (BSON) { author: 'joe', created: Date('03-28-2009'), title: 'Yet another blog post', text: 'Here is the text...', tags: [ 'example', 'joe' ], comments: [ { author: 'jim', comment: 'I disagree' }, { author: 'nancy', comment: 'Good post' } ] }
  • 16. Basics $ bin/mongod & $ bin/mongo ... > use mydb > j = { name: "mongo"}; {"name" : "mongo"} > t = { x : 3 }; { "x" : 3 } > db.things.save(j); > db.things.save(t); > db.things.find(); in cursor for : DBQuery: example.things -> {"name" : "mongo" , "_id" : "497cf60751712cf7758+dbb"} {"x" : 3 , "_id" : "497cf61651712cf7758+dbc"} >
  • 17. Querying • db.collection.find({‘first_name’: ‘John’}) # finds all Johns • db.collection.find({‘first_name’: /^J/}) # regex • db.collection.find_first({‘_id’:1}) # finds first with _id of 1 • db.collection.find({‘age’: {‘$gt’: 21}}) # finds possible drinkers • db.collection.find({‘author.first_name’:‘John’}) # subdocument • db.collection.find({$where:‘this.age >= 6 && this.age <= 18’})
  • 18. Querying 2 • $in, $nin, $all, $ne, $gt, $gte, $lt, $lte, $size, $where • :fields (like :select in active record) • :limit, :offset for pagination • :sort ascending or descending [[‘foo’, 1], [‘bar’, -1]] • count and group (uses map/reduce)
  • 20. Ruby support • mongo-ruby-driver • Pure Ruby, with optional C extension • MongoRecord • ORM like functionality • Other mappers
  • 21. Ruby basics • Connect: • db = Mongo.new.db(‘my-database’) • coll = db.collection(‘players’) • Insert: • coll.insert (“name” => “mike”, “age” => ... • Query: • coll.find (“age” => 35)
  • 22. Grid FS • File storage in MongoDB • IO-like API for Ruby
  • 23. Other cool stuff • Capped collections • Upserts • Multikeys
  • 24. Resources • http://spitfiresky.com/blog/recap-of-my-sdruby- presentation-on-mongodb.html • http://railstips.org/2009/6/3/what-if-a-key- value-store-mated-with-a-relational-database- system • http://www.mongodb.org/display/DOCS/ Production+Deployments • http://www.mongohq.com/home
  • 25. Resources 2 • http://api.mongodb.org/ruby/0.15.1/index.html • http://www.engineyard.com/blog/2009/ mongodb-a-light-in-the-darkness-key-value- stores-part-5 • http://queue.acm.org/detail.cfm?id=1394128