SlideShare a Scribd company logo
OTA Platform
with MongoDB
with MongoDB


     talks 19 Jan 2013
About Our Application
•   One stop shopping OTA (Online Travel Agency)

    •   Regular

    •   Flash Deals

•   Various type of products

    •   eg: hotels, flights, tours/activities, campaigns (flash
        deals), etc

•   Facilitate B2B travel
About Our Application
IS THAT IT?
About Our Application
Travel Ideas
  •   Travel News, up-to-date info all around the world

  •   Travel Tips

      •   based on places (countries, cities, areas)

      •   covers various aspects, such as overview, sightseeing,
          eating/restaurants, shopping and events

  •   Travel Stories, submitted by members

  •   Photos and Videos

  •   Blog, monthly theme posts based on event calendar
TRAVEL BUSINESS
BREAKTHROUGH
SOON ON YOUR BROWSER
Technology Overview
These are stuff that we use behind our apps
Web Server : Apache
Application : PHP
               CodeIgniter (PHP MVC Framework)
               Backbone.js (Javascript Framework) with its friends
               Require.js, Underscore.js, Mustache.js, jQuery

Database      : MongoDB
Why MongoDB?
•   It’s fast

•   Development speed time faster

•   No join, no relation

•   No sql injection worries (you bet)

•   Reduced database requests

•   Super flexible schema design

    •   Fewer tables/collections used
What do we store in
MongoDB?
              All datas are stored in MongoDB.

Including important data such as bookings,
inventory, etc.
Building the Apps...




We will tell you guys how
MongoDB helps us a lot
Saving huge amount of time
on database stuff

         spreadsheet is more than enough



db structure alters and changes
straight on the code
With RDBMS approach, dynamic
data is pain in the a*s

                 Embedded documents to the rescue



 This is how we handle dynamic data on our apps
Use Case

• Hotels may have multiple contracts
 • One hotel contracts may have multiple
    bank accounts
• Hotels may have multiple facilities
 • Hotel facilities have several categories
Schema Design
                                           MongoDB approach
            RDBMS approach




      more or less like this...
plus two/three tables for reference data
And now the query...
“get me hotels with its facilities which has BCA account in
                       Jakarta only”

 RDBMS approach
  SELECT * FROM hotels
  INNER JOIN facilities ....
  INNER JOIN photos ....
  AND THEN JOIN the_banks ....
  AND OF COURSE JOIN the_locations ....
  AND JOIN the_city ....
  WHERE
  the_city IS “Jakarta”
  AND
  the_banks IS “Bank BCA”



  We all know JOINs are expensive.
               Use EXPLAIN on SQL to see it
And now the query...
“get me hotels with its facilities which has BCA account in
                       Jakarta only”

      MongoDB approach
    db.hotel.find( { “locations.city” : “Jakarta” , “contracts.banks.name” : “Bank BCA” } )




One single query to fetch all the data we need
Be wise when choosing which
Data Models are used


      Embedded documents not applied to all data model




   We use referenced model when it comes to very
            large record sets / documents
Model Referenced One-to-Many
Relationships between Documents
   http://docs.mongodb.org/manual/tutorial/model-referenced-one-to-many-relationships-between-
   data-modeling-publisher-and-books




Normalize the data, just like RDBMS approach but
using “fake” relationship

Use key/id to store references between two documents
Use Case
• Each hotel may have multiple room types
 • One room type may have up to 10
    photos/videos
 • Each room type have their rate/price
 • Room rates based on contract period
    (one or more years)
 • Room rates stored daily
Use Case
Example :
A Hotel has 5 room types
Each Room type has 10 photos
Hotel contract period is one year

5 room types x 10 photos = 50 documents
5 room types x 365 room rates = 1825 documents

Total documents for 1 hotel :
1 + 5 + 50 + 1825 = 1881 documents
Use Case
     Example :
     Total documents for 1 hotel :
     1 + 5 + 50 + 1825 = 1881 documents

     If we have 1500 hotels then 1881 x 1500 = 2.821.500


What if we have more than 1500 hotels?
What if a hotel have more than 5 room types?
What if a room type has more than 15 photos?
And then we decided to separate the
collections that potentially has huge data

               example : room_rates, hotel_media, etc
More to see...
•   Other slides

    •   http://www.slideshare.net/h.ariawan/okezonecom-inline-voting-system

    •   http://www.slideshare.net/h.ariawan/sekilas-php-mongodb

•   Codes and Articles

    •   https://github.com/hadiariawan/monode-crud

    •   http://hadiariawan.web.id/2012/06/27/simple-crud-web-using-nodejs-and-
        mongodb/
@hadiariawan
    hadi.ariawan
http://about.me/hadiariawan

More Related Content

PDF
Using semi-structured data in modern applications
PDF
Using semi-structured data in modern applications
PPTX
AJAX, JSON, and Client-Side Templates
PPTX
Unt bank final presentation
PPTX
The Right (and Wrong) Use Cases for MongoDB
PDF
MongoDB World 2019: Polyglot Persistence with MongoDB: What You Need to Know ...
PPTX
Accelerating a Path to Digital With a Cloud Data Strategy
PPTX
Reponsive web design (HTML5 + css3)
Using semi-structured data in modern applications
Using semi-structured data in modern applications
AJAX, JSON, and Client-Side Templates
Unt bank final presentation
The Right (and Wrong) Use Cases for MongoDB
MongoDB World 2019: Polyglot Persistence with MongoDB: What You Need to Know ...
Accelerating a Path to Digital With a Cloud Data Strategy
Reponsive web design (HTML5 + css3)

What's hot (13)

PDF
Wanderu – Lessons from Building a Travel Site with Neo4j - Eddy Wong @ GraphC...
PPTX
MongoDB For Online Advertising at AOL
PDF
Wanderu - Lessons from Building a Travel Site with Neo4j
PPTX
[MongoDB.local Bengaluru 2018] Jumpstart: Introduction to Schema Design
PPTX
Introduction to MongoDB
PPTX
Web Scraping Technologies
KEY
MongoDB at CodeMash 2.0.1.0
PPTX
[MongoDB.local Bengaluru 2018] The Path to Truly Understanding Your MongoDB Data
PPTX
Business Jumpstart: The Right (and Wrong) Use Cases for MongoDB
PPTX
Data Analytics: Understanding Your MongoDB Data
PPTX
Jumpstart: Introduction to Schema Design
PPTX
Building A Relevancy Engine Using MongoDB and Go
PDF
Introduction to MongoDB Basics from SQL to NoSQL
Wanderu – Lessons from Building a Travel Site with Neo4j - Eddy Wong @ GraphC...
MongoDB For Online Advertising at AOL
Wanderu - Lessons from Building a Travel Site with Neo4j
[MongoDB.local Bengaluru 2018] Jumpstart: Introduction to Schema Design
Introduction to MongoDB
Web Scraping Technologies
MongoDB at CodeMash 2.0.1.0
[MongoDB.local Bengaluru 2018] The Path to Truly Understanding Your MongoDB Data
Business Jumpstart: The Right (and Wrong) Use Cases for MongoDB
Data Analytics: Understanding Your MongoDB Data
Jumpstart: Introduction to Schema Design
Building A Relevancy Engine Using MongoDB and Go
Introduction to MongoDB Basics from SQL to NoSQL
Ad

Viewers also liked (20)

PPTX
Webinar: Schema Design
PPTX
Sekilas PHP + mongoDB
PPTX
Old & wise(에듀시니어)
PPT
Tecnologìas de la Información y la Comunicación
PDF
Leinster college dublin - brochure web
PDF
MongoDB and AWS Best Practices
PDF
Introduction Pentaho 5.0
PDF
Review: Leadership Frameworks
PDF
2016 SRA Globalization Poster_Justice_Caruson
PPTX
Anti-social Databases
PPT
Migrating to git
PPTX
Division of roles and responsibilities
PDF
Cartagena Data Festival | Telling Stories with Data 2015 04-21
PPTX
MongoDB at Flight Centre Ltd
PPTX
Secret Life of a Weather Datum end of project event
PPTX
Mgidigitalglobalization
PPT
Av capabilities presentation
DOCX
GIT Best Practices V 0.1
PPTX
Heavy Metal PowerPivot Remastered
Webinar: Schema Design
Sekilas PHP + mongoDB
Old & wise(에듀시니어)
Tecnologìas de la Información y la Comunicación
Leinster college dublin - brochure web
MongoDB and AWS Best Practices
Introduction Pentaho 5.0
Review: Leadership Frameworks
2016 SRA Globalization Poster_Justice_Caruson
Anti-social Databases
Migrating to git
Division of roles and responsibilities
Cartagena Data Festival | Telling Stories with Data 2015 04-21
MongoDB at Flight Centre Ltd
Secret Life of a Weather Datum end of project event
Mgidigitalglobalization
Av capabilities presentation
GIT Best Practices V 0.1
Heavy Metal PowerPivot Remastered
Ad

Similar to OTA Platform with MongoDB (20)

KEY
Hybrid MongoDB and RDBMS Applications
PPTX
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
PPTX
Webinar: General Technical Overview of MongoDB for Dev Teams
PDF
Which Questions We Should Have
PDF
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
PPTX
An Evening with MongoDB Detroit 2013
PPTX
Mongo db conference march 2012 (1)
KEY
Building Your First MongoDB Application
PDF
Introduction to MongoDB
PDF
MongoDB Atlas Workshop - Singapore
PDF
Multi model-databases
PDF
Multi model-databases
PDF
Using Spring with NoSQL databases (SpringOne China 2012)
PPTX
First app online conf
KEY
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
PPTX
Nosql Now 2012: MongoDB Use Cases
PDF
MongoDB and Play! Framework workshop
PPTX
Webinar: “ditch Oracle NOW”: Best Practices for Migrating to MongoDB
PPTX
Database Trends for Modern Applications: Why the Database You Choose Matters
KEY
Mongo Seattle - The Business of MongoDB
Hybrid MongoDB and RDBMS Applications
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
Webinar: General Technical Overview of MongoDB for Dev Teams
Which Questions We Should Have
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
An Evening with MongoDB Detroit 2013
Mongo db conference march 2012 (1)
Building Your First MongoDB Application
Introduction to MongoDB
MongoDB Atlas Workshop - Singapore
Multi model-databases
Multi model-databases
Using Spring with NoSQL databases (SpringOne China 2012)
First app online conf
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Nosql Now 2012: MongoDB Use Cases
MongoDB and Play! Framework workshop
Webinar: “ditch Oracle NOW”: Best Practices for Migrating to MongoDB
Database Trends for Modern Applications: Why the Database You Choose Matters
Mongo Seattle - The Business of MongoDB

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPT
Teaching material agriculture food technology
PDF
cuic standard and advanced reporting.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Machine Learning_overview_presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
MYSQL Presentation for SQL database connectivity
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Weekly Chronicles - August'25-Week II
Encapsulation theory and applications.pdf
Teaching material agriculture food technology
cuic standard and advanced reporting.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation_ Review paper, used for researhc scholars
Machine Learning_overview_presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
“AI and Expert System Decision Support & Business Intelligence Systems”
MYSQL Presentation for SQL database connectivity
MIND Revenue Release Quarter 2 2025 Press Release
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Empathic Computing: Creating Shared Understanding
NewMind AI Weekly Chronicles - August'25-Week II

OTA Platform with MongoDB

  • 1. OTA Platform with MongoDB with MongoDB talks 19 Jan 2013
  • 2. About Our Application • One stop shopping OTA (Online Travel Agency) • Regular • Flash Deals • Various type of products • eg: hotels, flights, tours/activities, campaigns (flash deals), etc • Facilitate B2B travel
  • 5. About Our Application Travel Ideas • Travel News, up-to-date info all around the world • Travel Tips • based on places (countries, cities, areas) • covers various aspects, such as overview, sightseeing, eating/restaurants, shopping and events • Travel Stories, submitted by members • Photos and Videos • Blog, monthly theme posts based on event calendar
  • 7. SOON ON YOUR BROWSER
  • 8. Technology Overview These are stuff that we use behind our apps Web Server : Apache Application : PHP CodeIgniter (PHP MVC Framework) Backbone.js (Javascript Framework) with its friends Require.js, Underscore.js, Mustache.js, jQuery Database : MongoDB
  • 9. Why MongoDB? • It’s fast • Development speed time faster • No join, no relation • No sql injection worries (you bet) • Reduced database requests • Super flexible schema design • Fewer tables/collections used
  • 10. What do we store in MongoDB? All datas are stored in MongoDB. Including important data such as bookings, inventory, etc.
  • 11. Building the Apps... We will tell you guys how MongoDB helps us a lot
  • 12. Saving huge amount of time on database stuff spreadsheet is more than enough db structure alters and changes straight on the code
  • 13. With RDBMS approach, dynamic data is pain in the a*s Embedded documents to the rescue This is how we handle dynamic data on our apps
  • 14. Use Case • Hotels may have multiple contracts • One hotel contracts may have multiple bank accounts • Hotels may have multiple facilities • Hotel facilities have several categories
  • 15. Schema Design MongoDB approach RDBMS approach more or less like this... plus two/three tables for reference data
  • 16. And now the query... “get me hotels with its facilities which has BCA account in Jakarta only” RDBMS approach SELECT * FROM hotels INNER JOIN facilities .... INNER JOIN photos .... AND THEN JOIN the_banks .... AND OF COURSE JOIN the_locations .... AND JOIN the_city .... WHERE the_city IS “Jakarta” AND the_banks IS “Bank BCA” We all know JOINs are expensive. Use EXPLAIN on SQL to see it
  • 17. And now the query... “get me hotels with its facilities which has BCA account in Jakarta only” MongoDB approach db.hotel.find( { “locations.city” : “Jakarta” , “contracts.banks.name” : “Bank BCA” } ) One single query to fetch all the data we need
  • 18. Be wise when choosing which Data Models are used Embedded documents not applied to all data model We use referenced model when it comes to very large record sets / documents
  • 19. Model Referenced One-to-Many Relationships between Documents http://docs.mongodb.org/manual/tutorial/model-referenced-one-to-many-relationships-between- data-modeling-publisher-and-books Normalize the data, just like RDBMS approach but using “fake” relationship Use key/id to store references between two documents
  • 20. Use Case • Each hotel may have multiple room types • One room type may have up to 10 photos/videos • Each room type have their rate/price • Room rates based on contract period (one or more years) • Room rates stored daily
  • 21. Use Case Example : A Hotel has 5 room types Each Room type has 10 photos Hotel contract period is one year 5 room types x 10 photos = 50 documents 5 room types x 365 room rates = 1825 documents Total documents for 1 hotel : 1 + 5 + 50 + 1825 = 1881 documents
  • 22. Use Case Example : Total documents for 1 hotel : 1 + 5 + 50 + 1825 = 1881 documents If we have 1500 hotels then 1881 x 1500 = 2.821.500 What if we have more than 1500 hotels? What if a hotel have more than 5 room types? What if a room type has more than 15 photos?
  • 23. And then we decided to separate the collections that potentially has huge data example : room_rates, hotel_media, etc
  • 24. More to see... • Other slides • http://www.slideshare.net/h.ariawan/okezonecom-inline-voting-system • http://www.slideshare.net/h.ariawan/sekilas-php-mongodb • Codes and Articles • https://github.com/hadiariawan/monode-crud • http://hadiariawan.web.id/2012/06/27/simple-crud-web-using-nodejs-and- mongodb/
  • 25. @hadiariawan hadi.ariawan http://about.me/hadiariawan