SlideShare a Scribd company logo
1 of 14
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

Similar to Mongodb hackathon 01

Scaling with mongo db (with notes)
Scaling with mongo db (with notes)Scaling with mongo db (with notes)
Scaling with mongo db (with notes)emiltamas
 
Eat your own dog food using mongo db at mongodb
Eat your own dog food using mongo db at mongodbEat your own dog food using mongo db at mongodb
Eat your own dog food using mongo db at mongodbNAVER Engineering
 
3.15.17 DSpace: How to Contribute Webinar Slides
3.15.17 DSpace: How to Contribute Webinar Slides3.15.17 DSpace: How to Contribute Webinar Slides
3.15.17 DSpace: How to Contribute Webinar SlidesDuraSpace
 
Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014Kate Marshalkina
 
ResourceSync Tutorial from Open Repositories 2013
ResourceSync Tutorial from Open Repositories 2013ResourceSync Tutorial from Open Repositories 2013
ResourceSync Tutorial from Open Repositories 2013Simeon Warner
 
Collaborative filtering common_problems_and_solutions
Collaborative filtering common_problems_and_solutionsCollaborative filtering common_problems_and_solutions
Collaborative filtering common_problems_and_solutionsVivek Aanand Ganesan
 
Improving Model Predictions via Stacking and Hyper-parameters Tuning
Improving Model Predictions via Stacking and Hyper-parameters TuningImproving Model Predictions via Stacking and Hyper-parameters Tuning
Improving Model Predictions via Stacking and Hyper-parameters TuningJo-fai Chow
 
Softshake 2013 - Let's take this offline
Softshake 2013 - Let's take this offlineSoftshake 2013 - Let's take this offline
Softshake 2013 - Let's take this offlineClaire Reynaud
 
Open Closed Principle kata
Open Closed Principle kataOpen Closed Principle kata
Open Closed Principle kataPaul Blundell
 
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored ProceduresDynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored ProceduresBrent Ozar
 
A view from the ivory tower: Participating in Apache as a member of academia
A view from the ivory tower: Participating in Apache as a member of academiaA view from the ivory tower: Participating in Apache as a member of academia
A view from the ivory tower: Participating in Apache as a member of academiaMichael Mior
 
SensorThings API webinar-#4-Connect Your Sensor
SensorThings API webinar-#4-Connect Your SensorSensorThings API webinar-#4-Connect Your Sensor
SensorThings API webinar-#4-Connect Your SensorSensorUp
 
Bender kuszmaul tutorial-xldb12
Bender kuszmaul tutorial-xldb12Bender kuszmaul tutorial-xldb12
Bender kuszmaul tutorial-xldb12Atner Yegorov
 
Data Structures and Algorithms for Big Databases
Data Structures and Algorithms for Big DatabasesData Structures and Algorithms for Big Databases
Data Structures and Algorithms for Big Databasesomnidba
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaJohn Nestor
 
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)PyData
 
Building Spring Data with MongoDB
Building Spring Data with MongoDBBuilding Spring Data with MongoDB
Building Spring Data with MongoDBMongoDB
 
Lessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMLessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMValeri Karpov
 
PostgreSQL, your NoSQL database
PostgreSQL, your NoSQL databasePostgreSQL, your NoSQL database
PostgreSQL, your NoSQL databaseReuven Lerner
 
The Materials Project: Experiences from running a million computational scien...
The Materials Project: Experiences from running a million computational scien...The Materials Project: Experiences from running a million computational scien...
The Materials Project: Experiences from running a million computational scien...Anubhav Jain
 

Similar to Mongodb hackathon 01 (20)

Scaling with mongo db (with notes)
Scaling with mongo db (with notes)Scaling with mongo db (with notes)
Scaling with mongo db (with notes)
 
Eat your own dog food using mongo db at mongodb
Eat your own dog food using mongo db at mongodbEat your own dog food using mongo db at mongodb
Eat your own dog food using mongo db at mongodb
 
3.15.17 DSpace: How to Contribute Webinar Slides
3.15.17 DSpace: How to Contribute Webinar Slides3.15.17 DSpace: How to Contribute Webinar Slides
3.15.17 DSpace: How to Contribute Webinar Slides
 
Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014
 
ResourceSync Tutorial from Open Repositories 2013
ResourceSync Tutorial from Open Repositories 2013ResourceSync Tutorial from Open Repositories 2013
ResourceSync Tutorial from Open Repositories 2013
 
Collaborative filtering common_problems_and_solutions
Collaborative filtering common_problems_and_solutionsCollaborative filtering common_problems_and_solutions
Collaborative filtering common_problems_and_solutions
 
Improving Model Predictions via Stacking and Hyper-parameters Tuning
Improving Model Predictions via Stacking and Hyper-parameters TuningImproving Model Predictions via Stacking and Hyper-parameters Tuning
Improving Model Predictions via Stacking and Hyper-parameters Tuning
 
Softshake 2013 - Let's take this offline
Softshake 2013 - Let's take this offlineSoftshake 2013 - Let's take this offline
Softshake 2013 - Let's take this offline
 
Open Closed Principle kata
Open Closed Principle kataOpen Closed Principle kata
Open Closed Principle kata
 
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored ProceduresDynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
 
A view from the ivory tower: Participating in Apache as a member of academia
A view from the ivory tower: Participating in Apache as a member of academiaA view from the ivory tower: Participating in Apache as a member of academia
A view from the ivory tower: Participating in Apache as a member of academia
 
SensorThings API webinar-#4-Connect Your Sensor
SensorThings API webinar-#4-Connect Your SensorSensorThings API webinar-#4-Connect Your Sensor
SensorThings API webinar-#4-Connect Your Sensor
 
Bender kuszmaul tutorial-xldb12
Bender kuszmaul tutorial-xldb12Bender kuszmaul tutorial-xldb12
Bender kuszmaul tutorial-xldb12
 
Data Structures and Algorithms for Big Databases
Data Structures and Algorithms for Big DatabasesData Structures and Algorithms for Big Databases
Data Structures and Algorithms for Big Databases
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)
How Web APIs and Data Centric Tools Power the Materials Project (PyData SV 2013)
 
Building Spring Data with MongoDB
Building Spring Data with MongoDBBuilding Spring Data with MongoDB
Building Spring Data with MongoDB
 
Lessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMLessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODM
 
PostgreSQL, your NoSQL database
PostgreSQL, your NoSQL databasePostgreSQL, your NoSQL database
PostgreSQL, your NoSQL database
 
The Materials Project: Experiences from running a million computational scien...
The Materials Project: Experiences from running a million computational scien...The Materials Project: Experiences from running a million computational scien...
The Materials Project: Experiences from running a million computational scien...
 

Recently uploaded

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
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
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
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
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 

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