Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] MongoDB | PDF
SlideShare a Scribd company logo
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
MongoDB
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!

More Related Content

KEY
MongoDB London PHP
PPTX
Efficient In-situ Processing of Various Storage Types on Apache Tajo
PDF
CosmosDb for beginners
KEY
Using NoSQL MongoDB with ColdFusion
PDF
Introduction to couchdb
PDF
Introduction to MongoDB
PDF
Drupal 7: What's In It For You?
MongoDB London PHP
Efficient In-situ Processing of Various Storage Types on Apache Tajo
CosmosDb for beginners
Using NoSQL MongoDB with ColdFusion
Introduction to couchdb
Introduction to MongoDB
Drupal 7: What's In It For You?

What's hot (20)

PDF
Intro To MongoDB
PDF
Mongo db
PDF
MongoDB for Coder Training (Coding Serbia 2013)
PDF
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)
PPTX
JS App Architecture
PPTX
Introduction to mongo db
PPTX
Accesso ai dati con Azure Data Platform
PPTX
PPTX
Explore the Cosmos (DB) with .NET Core 2.0
PPTX
MongoDB introduction
PPTX
Azure storage
PPTX
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
KEY
MongoDB and Ecommerce : A perfect combination
PDF
SDEC2011 NoSQL Data modelling
PPTX
Mongo db operations_v2
PPTX
Azure doc db (slideshare)
PPTX
Demystfying nosql databases
PPTX
Azure Storage Services - Part 01
PPTX
Basics of MongoDB
Intro To MongoDB
Mongo db
MongoDB for Coder Training (Coding Serbia 2013)
ITB2016 - NoSQL with mongodb and ColdFusion (CFML)
JS App Architecture
Introduction to mongo db
Accesso ai dati con Azure Data Platform
Explore the Cosmos (DB) with .NET Core 2.0
MongoDB introduction
Azure storage
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
MongoDB and Ecommerce : A perfect combination
SDEC2011 NoSQL Data modelling
Mongo db operations_v2
Azure doc db (slideshare)
Demystfying nosql databases
Azure Storage Services - Part 01
Basics of MongoDB
Ad

Viewers also liked (7)

PPTX
Inteligencias multiples
PPTX
Inteligencias multiples
PDF
Lectura 5. las inteligencias multiples
PDF
Proyecto paleta de inteligencias multiples celula animal vs celula vegetal
PPTX
Presentación inteligencias multiples
PPT
seguridad
PDF
Os Harris
Inteligencias multiples
Inteligencias multiples
Lectura 5. las inteligencias multiples
Proyecto paleta de inteligencias multiples celula animal vs celula vegetal
Presentación inteligencias multiples
seguridad
Os Harris
Ad

Similar to MongoDB (20)

PPTX
Drop acid
PPTX
MongoDB
PDF
Scaling the Web: Databases & NoSQL
KEY
Introduction to MongoDB
PDF
Spring one2gx2010 spring-nonrelational_data
PPTX
Introduction to NoSQL
PDF
Oracle Week 2016 - Modern Data Architecture
PDF
Using Spring with NoSQL databases (SpringOne China 2012)
KEY
MongoDB SF Ruby
PPTX
A Presentation on MongoDB Introduction - Habilelabs
PPTX
UNIT I Introduction to NoSQL.pptx
PPTX
UNIT I Introduction to NoSQL.pptx
PPT
No sql Database
KEY
KeyValue Stores
PDF
Baisc introduction of mongodb for beginn
PDF
20-NoSQLMongoDbiig data analytics hB.pdf
PPTX
No SQL : Which way to go? Presented at DDDMelbourne 2015
PPTX
NoSQL, which way to go?
PPTX
Introduction to Data Science NoSQL.pptx
PDF
High-Performance Storage Services with HailDB and Java
Drop acid
MongoDB
Scaling the Web: Databases & NoSQL
Introduction to MongoDB
Spring one2gx2010 spring-nonrelational_data
Introduction to NoSQL
Oracle Week 2016 - Modern Data Architecture
Using Spring with NoSQL databases (SpringOne China 2012)
MongoDB SF Ruby
A Presentation on MongoDB Introduction - Habilelabs
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
No sql Database
KeyValue Stores
Baisc introduction of mongodb for beginn
20-NoSQLMongoDbiig data analytics hB.pdf
No SQL : Which way to go? Presented at DDDMelbourne 2015
NoSQL, which way to go?
Introduction to Data Science NoSQL.pptx
High-Performance Storage Services with HailDB and Java

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Machine learning based COVID-19 study performance prediction
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Approach and Philosophy of On baking technology
Empathic Computing: Creating Shared Understanding
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Machine learning based COVID-19 study performance prediction
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Dropbox Q2 2025 Financial Results & Investor Presentation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
A Presentation on Artificial Intelligence
NewMind AI Monthly Chronicles - July 2025
20250228 LYD VKU AI Blended-Learning.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

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
  • 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