Mongodb hackathon 01

827 views

Published on

2 Comments
3 Likes
Statistics
Notes
No Downloads
Views
Total views
827
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
12
Comments
2
Likes
3
Embeds 0
No embeds

No notes for slide

Mongodb hackathon 01

  1. 1. MongoDB Hackathon 01Vivek A. Ganesanvivganes@gmail.comBig Data Gods Meetup, Santa Clara, CA May11, 2013
  2. 2. Before we startCopyright 2013, Vivek A. Ganesan, All rights reserved 1o A BIG thank you to our sponsors –Big Data Cloudo Meeting Spaceo Food + Drinkso Consulting/Training
  3. 3. AgendaCopyright 2013, Vivek A. Ganesan, All rights reserved 2o Introductiono SQL to Mongoo Mongo Shello Working with Mongo Clientso Bulk Load
  4. 4. IntroductionCopyright 2013, Vivek A. Ganesan, All rights reserved 3o This is a hackathon, not a classo Which means we work on stuff togethero Please consult and help your team mateso There will be labs (that’s when we learn!)o Talk to your team mates and figure out what problemyou want to solveo We will be prepping our data sets for the next meetup
  5. 5. About this Meetup : StructureCopyright 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 andDeployment)• Week 4 : Panel + Demo• Showcase Startups/Experts inthe space• Teams show demos• Panel judges winners• We might have prizes (needsto be figured out)
  6. 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. 7. Lab 1 – Installation (15 minutes)Copyright 2013, Vivek A. Ganesan, All rights reserved 6
  8. 8. SQL to MongoDB - ConceptsCopyright 2013, Vivek A. Ganesan, All rights reserved 7
  9. 9. What is JSON?Copyright 2013, Vivek A. Ganesan, All rights reserved 8
  10. 10. SQL DDL to MongoDBCopyright 2013, Vivek A. Ganesan, All rights reserved 9
  11. 11. Lab 2 – Basic CRUDCopyright 2013, Vivek A. Ganesan, All rights reserved 10o 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 loopo Blog data : post_title, post_body and post_tags as CSVo Update ten posts with a created_on key and the currenttimestampo Update the posts such that at least three posts have a “foo”tag (use the cursor functionality to iterate)
  12. 12. Lab 3 – Mastering findCopyright 2013, Vivek A. Ganesan, All rights reserved 11o In a Mongo Shell,o Figure out the difference between find and findOneo Try find on posts without any query parameterso Find all posts but extract only the post_title fieldo List all posts but in reverse order of created_on i.e. mostrecent firsto Do the same as above but paginate is sets of threeo Find all posts that contain a tag called “foo”o Find all posts that contain “foo” and sort by created_on
  13. 13. Lab 4 – ModifiersCopyright 2013, Vivek A. Ganesan, All rights reserved 12o In a Mongo Shell,o Modify “posts” collectiono Change the post_tags field to an array instead of aCSV listo Add a new field called view_count and set it 0o Increment view_count by 1o Push three new tags to the post_tags fieldo Pop the last two tags added to post_tags field
  14. 14. Questions? Comments?Thank You!E-mail: vivganes@gmail.comTwitter : onevivekCopyright 2013, Vivek A. Ganesan, All rightsreserved13

×