SlideShare a Scribd company logo
1 of 27
Download to read offline
MongoDB, a document store that won't let
              you down


                  Nurul Ferdous
     Platform Architect at Tasawr Interactive
        @ferdous, http://dynamicguy.com
Web 1.0
Web 2.0
MySQL problem
Resolution
NoSQL vs RDBMS

          NoSQL                        RDBMS
● Schema-free              ●   Relational schema
                           ●   Scalable reads
● Scalable writes/reads
                           ●   Custom high-availability
● Auto high-availability   ●   Flexible queries
● Limited queries          ●   Consistency
● Eventual Consistency     ●   ACID
● BASE
Who else there?
CAP theorem
MongoDB in CAP
Installing MongoDB server

ubuntu way
    ●   sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
    ●   deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist
        10gen
    ●   sudo apt-get update
    ●   sudo apt-get install mongodb-10gen
 
windows (shame on you!) way
    ●   Download - http://mongodb.org/downloads
    ●   Unzip
    ●   Create a data directory
    ●   Run and connect to the server
 
p.s.: 32bit is limited to 2.5gb size limit.
Understanding MongoDB
Understanding MongoDB
Understanding MongoDB
Understanding MongoDB
Understanding MongoDB
Understanding MongoDB
Understanding MongoDB
Understanding MongoDB
Understanding MongoDB
PHP and MongoDB

Installation
 
 
 
 
 
or `sudo pecl install mongo`
To load the extension, add a line in php.ini:
`extension=mongo.so` # of course without quote
 
Connection
Query
CRUD
SQL to MongoDB
CREATE TABLE USERS (a Number, b Number)       $db->users->insert(array("a" => 1, "b" => 1));
INSERT INTO USERS VALUES(1,1)                 $db->users->find(array(), array("a" => 1, "b" => 1));
SELECT a,b FROM users                         $db->users->find(array("age" => 33));
SELECT * FROM users WHERE age=33              $db->users->find(array("age" => 33), array("a" => 1,
SELECT a,b FROM users WHERE age=33            "b" => 1));
SELECT a,b FROM users WHERE age=33 ORDER      $db->users->find(array("age" => 33), array("a" => 1,
BY name                                       "b" => 1))->sort(array("name" => 1));
SELECT * FROM users WHERE age>33              $db->users->find(array("age" => array('$gt' => 33)));
SELECT * FROM users WHERE age<33              $db->users->find(array("age" => array('$lt' => 33)));
SELECT * FROM users WHERE name LIKE "%Joe%"   $db->users->find(array("name" => new MongoRegex
                                              ("/Joe/")));
SELECT * FROM users WHERE name LIKE "Joe%"
                                              $db->users->find(array("name" => new MongoRegex
SELECT * FROM users WHERE age>33 AND
                                              ("/^Joe/")));
age<=40
                                              $db->users->find(array("age" => array('$gt' => 33,
SELECT * FROM users ORDER BY name DESC
                                              '$lte' => 40)));
                                              $db->users->find()->sort(array("name" => -1));
Map Reduce
Map Reduce
Question?

● I am
  ○ Nurul Ferdous <nurul@ferdo.us>
  ○ @ferdous
  ○ http://dynamicguy.com/
 
● Try it out
  ○ http://www.mongodb.org/downloads#
  ○ http://www.php.net/manual/en/book.mongo.php

More Related Content

What's hot

新建 文本文档
新建 文本文档新建 文本文档
新建 文本文档
mytwice
 

What's hot (20)

Cookies
CookiesCookies
Cookies
 
与 PHP 和 Perl 使用 MySQL 数据库
与 PHP 和 Perl 使用 MySQL 数据库与 PHP 和 Perl 使用 MySQL 数据库
与 PHP 和 Perl 使用 MySQL 数据库
 
Being Google
Being GoogleBeing Google
Being Google
 
NoSQL - Hands on
NoSQL - Hands onNoSQL - Hands on
NoSQL - Hands on
 
忙しい人のためのSphinx 入門 demo
忙しい人のためのSphinx 入門 demo忙しい人のためのSphinx 入門 demo
忙しい人のためのSphinx 入門 demo
 
新建 文本文档
新建 文本文档新建 文本文档
新建 文本文档
 
Mastering the MongoDB Shell
Mastering the MongoDB ShellMastering the MongoDB Shell
Mastering the MongoDB Shell
 
Protecting Your Clients' Privacy
Protecting Your Clients' PrivacyProtecting Your Clients' Privacy
Protecting Your Clients' Privacy
 
How to send files to remote server via ssh in php
How to send files to remote server via ssh in phpHow to send files to remote server via ssh in php
How to send files to remote server via ssh in php
 
Mongo db pagination
Mongo db paginationMongo db pagination
Mongo db pagination
 
Python and MongoDB
Python and MongoDBPython and MongoDB
Python and MongoDB
 
LiveScript &lt;| Rocking your world.js
LiveScript &lt;| Rocking your world.js LiveScript &lt;| Rocking your world.js
LiveScript &lt;| Rocking your world.js
 
How do i Meet MongoDB
How do i Meet MongoDBHow do i Meet MongoDB
How do i Meet MongoDB
 
FormValidator::LazyWay で検証ルールをまとめよう
FormValidator::LazyWay で検証ルールをまとめようFormValidator::LazyWay で検証ルールをまとめよう
FormValidator::LazyWay で検証ルールをまとめよう
 
Comets notes
Comets notesComets notes
Comets notes
 
Moose Lightning Talk
Moose Lightning TalkMoose Lightning Talk
Moose Lightning Talk
 
Mongo db
Mongo dbMongo db
Mongo db
 
RESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens АuerRESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens Аuer
 
Cookie and session
Cookie and sessionCookie and session
Cookie and session
 
Locality sensitive hashing
Locality sensitive hashingLocality sensitive hashing
Locality sensitive hashing
 

Similar to MongoDB a document store that won't let you down.

PHP Development With MongoDB
PHP Development With MongoDBPHP Development With MongoDB
PHP Development With MongoDB
Fitz Agard
 
PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)
MongoSF
 
MongoDB - A Document NoSQL Database
MongoDB - A Document NoSQL DatabaseMongoDB - A Document NoSQL Database
MongoDB - A Document NoSQL Database
Ruben Inoto Soto
 
MongoDb and NoSQL
MongoDb and NoSQLMongoDb and NoSQL
MongoDb and NoSQL
TO THE NEW | Technology
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Db
chriskite
 
2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_new2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_new
MongoDB
 
Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01
Cevin Cheung
 

Similar to MongoDB a document store that won't let you down. (20)

MongoDB
MongoDBMongoDB
MongoDB
 
PHP Development With MongoDB
PHP Development With MongoDBPHP Development With MongoDB
PHP Development With MongoDB
 
PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
Sekilas PHP + mongoDB
Sekilas PHP + mongoDBSekilas PHP + mongoDB
Sekilas PHP + mongoDB
 
MongoDB - A Document NoSQL Database
MongoDB - A Document NoSQL DatabaseMongoDB - A Document NoSQL Database
MongoDB - A Document NoSQL Database
 
This upload requires better support for ODP format
This upload requires better support for ODP formatThis upload requires better support for ODP format
This upload requires better support for ODP format
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 
DrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and DrupalDrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and Drupal
 
Rails with mongodb
Rails with mongodbRails with mongodb
Rails with mongodb
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
Shankar's mongo db presentation
Shankar's mongo db presentationShankar's mongo db presentation
Shankar's mongo db presentation
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg Solutions
 
MongoDb and NoSQL
MongoDb and NoSQLMongoDb and NoSQL
MongoDb and NoSQL
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Db
 
2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_new2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_new
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01Mongodbinaction 100122230824-phpapp01
Mongodbinaction 100122230824-phpapp01
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

MongoDB a document store that won't let you down.

  • 1. MongoDB, a document store that won't let you down Nurul Ferdous Platform Architect at Tasawr Interactive @ferdous, http://dynamicguy.com
  • 6. NoSQL vs RDBMS NoSQL RDBMS ● Schema-free ● Relational schema ● Scalable reads ● Scalable writes/reads ● Custom high-availability ● Auto high-availability ● Flexible queries ● Limited queries ● Consistency ● Eventual Consistency ● ACID ● BASE
  • 10. Installing MongoDB server ubuntu way ● sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 ● deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen ● sudo apt-get update ● sudo apt-get install mongodb-10gen   windows (shame on you!) way ● Download - http://mongodb.org/downloads ● Unzip ● Create a data directory ● Run and connect to the server   p.s.: 32bit is limited to 2.5gb size limit.
  • 20. PHP and MongoDB Installation           or `sudo pecl install mongo` To load the extension, add a line in php.ini: `extension=mongo.so` # of course without quote  
  • 22. Query
  • 23. CRUD
  • 24. SQL to MongoDB CREATE TABLE USERS (a Number, b Number) $db->users->insert(array("a" => 1, "b" => 1)); INSERT INTO USERS VALUES(1,1) $db->users->find(array(), array("a" => 1, "b" => 1)); SELECT a,b FROM users $db->users->find(array("age" => 33)); SELECT * FROM users WHERE age=33 $db->users->find(array("age" => 33), array("a" => 1, SELECT a,b FROM users WHERE age=33 "b" => 1)); SELECT a,b FROM users WHERE age=33 ORDER $db->users->find(array("age" => 33), array("a" => 1, BY name "b" => 1))->sort(array("name" => 1)); SELECT * FROM users WHERE age>33 $db->users->find(array("age" => array('$gt' => 33))); SELECT * FROM users WHERE age<33 $db->users->find(array("age" => array('$lt' => 33))); SELECT * FROM users WHERE name LIKE "%Joe%" $db->users->find(array("name" => new MongoRegex ("/Joe/"))); SELECT * FROM users WHERE name LIKE "Joe%" $db->users->find(array("name" => new MongoRegex SELECT * FROM users WHERE age>33 AND ("/^Joe/"))); age<=40 $db->users->find(array("age" => array('$gt' => 33, SELECT * FROM users ORDER BY name DESC '$lte' => 40))); $db->users->find()->sort(array("name" => -1));
  • 27. Question? ● I am ○ Nurul Ferdous <nurul@ferdo.us> ○ @ferdous ○ http://dynamicguy.com/   ● Try it out ○ http://www.mongodb.org/downloads# ○ http://www.php.net/manual/en/book.mongo.php