SlideShare a Scribd company logo
MongoDB Hackathon 01
Vivek A. Ganesan
vivganes@gmail.com
Big Data Gods Meetup, Santa Clara, CA May
11, 2013
Before we start
Copyright 2013, Vivek A. Ganesan, All rights reserved 1
o A BIG thank you to our sponsors –
Big Data Cloud
o Meeting Space
o Food + Drinks
o Consulting/Training
Agenda
Copyright 2013, Vivek A. Ganesan, All rights reserved 2
o Introduction
o SQL to Mongo
o Mongo Shell
o Working with Mongo Clients
o Bulk Load
Introduction
Copyright 2013, Vivek A. Ganesan, All rights reserved 3
o This is a hackathon, not a class
o Which means we work on stuff together
o Please consult and help your team mates
o There will be labs (that’s when we learn!)
o Talk to your team mates and figure out what problem
you want to solve
o We will be prepping our data sets for the next meetup
About this Meetup : Structure
Copyright 2013, Vivek A. Ganesan, All rights reserved 4
• Agile teams
• Week 1 : Introduction to Problem
• Week 2 : Algorithm + Platform
• Week 3 : Technical help
(Algorithm, Platform, Testing and
Deployment)
• Week 4 : Panel + Demo
• Showcase Startups/Experts in
the space
• Teams show demos
• Panel judges winners
• We might have prizes (needs
to be figured out)
Why No SQL?
Copyright 2013, Vivek A. Ganesan, All rights reserved 5
• Structured vs. Unstructured Data
• Correctness vs. Agility
• No need for Strict Consistency
• Consistency comes with a penalty
• For some applications, eventual consistency is enough
• Data Categories
• Key/Value type data
• Hierarchical relationships
• Graphs
• Horizontal Scaling
• Scale out instead of Scaling up
• CAP Theorem
• Consistency, Availability and Partition tolerance
• Pick any two!
Lab 1 – Installation (15 minutes)
Copyright 2013, Vivek A. Ganesan, All rights reserved 6
SQL to MongoDB - Concepts
Copyright 2013, Vivek A. Ganesan, All rights reserved 7
What is JSON?
Copyright 2013, Vivek A. Ganesan, All rights reserved 8
SQL DDL to MongoDB
Copyright 2013, Vivek A. Ganesan, All rights reserved 9
Lab 2 – Basic CRUD
Copyright 2013, Vivek A. Ganesan, All rights reserved 10
o In a Mongo Shell,
o Create a new database called “blog”
o Create a collection called “users”
o Insert a single user called “admin”
o Create a collection called “posts”
o Insert ten posts using a loop
o Blog data : post_title, post_body and post_tags as CSV
o Update ten posts with a created_on key and the current
timestamp
o Update the posts such that at least three posts have a “foo”
tag (use the cursor functionality to iterate)
Lab 3 – Mastering find
Copyright 2013, Vivek A. Ganesan, All rights reserved 11
o In a Mongo Shell,
o Figure out the difference between find and findOne
o Try find on posts without any query parameters
o Find all posts but extract only the post_title field
o List all posts but in reverse order of created_on i.e. most
recent first
o Do the same as above but paginate is sets of three
o Find all posts that contain a tag called “foo”
o Find all posts that contain “foo” and sort by created_on
Lab 4 – Modifiers
Copyright 2013, Vivek A. Ganesan, All rights reserved 12
o In a Mongo Shell,
o Modify “posts” collection
o Change the post_tags field to an array instead of a
CSV list
o Add a new field called view_count and set it 0
o Increment view_count by 1
o Push three new tags to the post_tags field
o Pop the last two tags added to post_tags field
Questions? Comments?
Thank You!
E-mail: vivganes@gmail.com
Twitter : onevivek
Copyright 2013, Vivek A. Ganesan, All rights
reserved
13

More Related Content

PPTX
Collaborative filtering getting_started
PPTX
Recommendation Engines Program Kickoff
PPTX
Mongodb hackathon 02
PDF
Big data pipelines
PPTX
Introduction to Data Engineering
PDF
Transforming the OPAC: Web 2.0, Mobile, and Discovery
ODP
No More SQL
PDF
Joker'15 Java straitjackets for MongoDB
Collaborative filtering getting_started
Recommendation Engines Program Kickoff
Mongodb hackathon 02
Big data pipelines
Introduction to Data Engineering
Transforming the OPAC: Web 2.0, Mobile, and Discovery
No More SQL
Joker'15 Java straitjackets for MongoDB

Similar to Mongodb hackathon 01 (20)

PDF
Scaling with mongo db (with notes)
PDF
Eat your own dog food using mongo db at mongodb
PPTX
3.15.17 DSpace: How to Contribute Webinar Slides
PPTX
Drupal meets PostgreSQL for DrupalCamp MSK 2014
PPTX
05201349_Unit_7_FSWD_ advanced learning.pptx
PPTX
05201349_Unit_7_FSWD_II(1) with advance.pptx
PPTX
05201349_Unit_7_FSWD_ advanced learning.pptx
PPTX
05201349_Unit_7_FSWD_II(1) with advance.pptx
PPTX
ResourceSync Tutorial from Open Repositories 2013
PPTX
Collaborative filtering common_problems_and_solutions
PPTX
Improving Model Predictions via Stacking and Hyper-parameters Tuning
PDF
Softshake 2013 - Let's take this offline
PPTX
Open Closed Principle kata
PPTX
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
PDF
A view from the ivory tower: Participating in Apache as a member of academia
PDF
SensorThings API webinar-#4-Connect Your Sensor
PDF
Data Structures and Algorithms for Big Databases
PDF
Bender kuszmaul tutorial-xldb12
PDF
Experience Converting from Ruby to Scala
PDF
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)
Scaling with mongo db (with notes)
Eat your own dog food using mongo db at mongodb
3.15.17 DSpace: How to Contribute Webinar Slides
Drupal meets PostgreSQL for DrupalCamp MSK 2014
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
ResourceSync Tutorial from Open Repositories 2013
Collaborative filtering common_problems_and_solutions
Improving Model Predictions via Stacking and Hyper-parameters Tuning
Softshake 2013 - Let's take this offline
Open Closed Principle kata
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
A view from the ivory tower: Participating in Apache as a member of academia
SensorThings API webinar-#4-Connect Your Sensor
Data Structures and Algorithms for Big Databases
Bender kuszmaul tutorial-xldb12
Experience Converting from Ruby to Scala
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Modernizing your data center with Dell and AMD
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Approach and Philosophy of On baking technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Electronic commerce courselecture one. Pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation theory and applications.pdf
PPT
Teaching material agriculture food technology
Encapsulation_ Review paper, used for researhc scholars
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Diabetes mellitus diagnosis method based random forest with bat algorithm
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Understanding_Digital_Forensics_Presentation.pptx
Modernizing your data center with Dell and AMD
Chapter 3 Spatial Domain Image Processing.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Approach and Philosophy of On baking technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Electronic commerce courselecture one. Pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
cuic standard and advanced reporting.pdf
Encapsulation theory and applications.pdf
Teaching material agriculture food technology

Mongodb hackathon 01

  • 1. MongoDB Hackathon 01 Vivek A. Ganesan vivganes@gmail.com Big Data Gods Meetup, Santa Clara, CA May 11, 2013
  • 2. Before we start Copyright 2013, Vivek A. Ganesan, All rights reserved 1 o A BIG thank you to our sponsors – Big Data Cloud o Meeting Space o Food + Drinks o Consulting/Training
  • 3. Agenda Copyright 2013, Vivek A. Ganesan, All rights reserved 2 o Introduction o SQL to Mongo o Mongo Shell o Working with Mongo Clients o Bulk Load
  • 4. Introduction Copyright 2013, Vivek A. Ganesan, All rights reserved 3 o This is a hackathon, not a class o Which means we work on stuff together o Please consult and help your team mates o There will be labs (that’s when we learn!) o Talk to your team mates and figure out what problem you want to solve o We will be prepping our data sets for the next meetup
  • 5. About this Meetup : Structure Copyright 2013, Vivek A. Ganesan, All rights reserved 4 • Agile teams • Week 1 : Introduction to Problem • Week 2 : Algorithm + Platform • Week 3 : Technical help (Algorithm, Platform, Testing and Deployment) • Week 4 : Panel + Demo • Showcase Startups/Experts in the space • Teams show demos • Panel judges winners • We might have prizes (needs to be figured out)
  • 6. Why No SQL? Copyright 2013, Vivek A. Ganesan, All rights reserved 5 • Structured vs. Unstructured Data • Correctness vs. Agility • No need for Strict Consistency • Consistency comes with a penalty • For some applications, eventual consistency is enough • Data Categories • Key/Value type data • Hierarchical relationships • Graphs • Horizontal Scaling • Scale out instead of Scaling up • CAP Theorem • Consistency, Availability and Partition tolerance • Pick any two!
  • 7. Lab 1 – Installation (15 minutes) Copyright 2013, Vivek A. Ganesan, All rights reserved 6
  • 8. SQL to MongoDB - Concepts Copyright 2013, Vivek A. Ganesan, All rights reserved 7
  • 9. What is JSON? Copyright 2013, Vivek A. Ganesan, All rights reserved 8
  • 10. SQL DDL to MongoDB Copyright 2013, Vivek A. Ganesan, All rights reserved 9
  • 11. Lab 2 – Basic CRUD Copyright 2013, Vivek A. Ganesan, All rights reserved 10 o In a Mongo Shell, o Create a new database called “blog” o Create a collection called “users” o Insert a single user called “admin” o Create a collection called “posts” o Insert ten posts using a loop o Blog data : post_title, post_body and post_tags as CSV o Update ten posts with a created_on key and the current timestamp o Update the posts such that at least three posts have a “foo” tag (use the cursor functionality to iterate)
  • 12. Lab 3 – Mastering find Copyright 2013, Vivek A. Ganesan, All rights reserved 11 o In a Mongo Shell, o Figure out the difference between find and findOne o Try find on posts without any query parameters o Find all posts but extract only the post_title field o List all posts but in reverse order of created_on i.e. most recent first o Do the same as above but paginate is sets of three o Find all posts that contain a tag called “foo” o Find all posts that contain “foo” and sort by created_on
  • 13. Lab 4 – Modifiers Copyright 2013, Vivek A. Ganesan, All rights reserved 12 o In a Mongo Shell, o Modify “posts” collection o Change the post_tags field to an array instead of a CSV list o Add a new field called view_count and set it 0 o Increment view_count by 1 o Push three new tags to the post_tags field o Pop the last two tags added to post_tags field
  • 14. Questions? Comments? Thank You! E-mail: vivganes@gmail.com Twitter : onevivek Copyright 2013, Vivek A. Ganesan, All rights reserved 13