HandsOn MongoDB
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

HandsOn MongoDB

  • 5,199 views
Uploaded on

deck from

deck from

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,199
On Slideshare
2,979
From Embeds
2,220
Number of Embeds
5

Actions

Shares
Downloads
114
Comments
0
Likes
5

Embeds 2,220

http://lynnlangit.com 2,162
https://twitter.com 46
http://tweetedtimes.com 9
http://reader.aol.com 2
http://www.newsblur.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Source - http://www.10gen.com/what-is-mongodb
  • http://www.mongodb.org/downloadshttps://github.com/mongodb/mongo-csharp-driver/downloads
  • http://www.10gen.com/reference
  • https://www.youtube.com/watch?v=k2YFy5IQu1M
  • http://www.mongovue.com/
  • Free conversion (CSV to JSON) - http://www.cparker15.com/code/utilities/csv-to-json/
  • http://www.mongovue.com/2010/06/29/find/
  • http://rickosborne.org/download/SQL-to-MongoDB.pdf
  • http://api.mongodb.org/wiki/current/Aggregation.html
  • http://docs.mongodb.org/manual/aggregation/And http://docs.mongodb.org/manual/reference/sql-aggregation-comparison/
  • http://blog.mongovue.com/2010/11/03/yet-another-mongodb-map-reduce-tutorial/
  • http://www.mongovue.com/2010/11/03/yet-another-mongodb-map-reduce-tutorial/Link to download source data - http://www.geobytes.com/freeservices.htm
  • http://learnmongo.com/posts/getting-started-with-mongodb-gridfs/Example: http://stackoverflow.com/questions/4988436/mongodb-gridfs-with-c-how-to-store-files-such-as-images/10645816#10645816Default chunk size is 256kbDb.fs.filesFs.chunkUpload.date.date()
  • http://www.mongovue.com/2010/09/14/updating-collections/
  • https://www.youtube.com/watch?v=NCp4n6xWw68
  • http://www.youtube.com/watch?v=NCp4n6xWw68
  • http://docs.mongodb.org/manual/faq/developers/#how-do-i-do-transactions-and-locking-in-mongodb
  • http://www.mongodb.org/display/DOCS/Use+Cases
  • http://www.mongodb.org/display/DOCS/Use+Cases
  • Lynn

Transcript

  • 1. Hands On Lynn Langit April 2013 – for BigData Tech Con – Boston, MA
  • 2. Data Expertise / Lynn Langit• Industry awards – Microsoft – MVP for SQL Server – Google – GDE for Cloud Platform – 10Gen – Master for MongoDB• Practicing Architect• Technical author / trainer – Pluralsight – Google Cloud Series – DevelopMentor – SQL Server Series – 2 books on SQL Server BI• Former MSFT FTE – 4 years
  • 3. What is MongoDB? Stores JSON-like Open source Document- documentsNoSQL database oriented (dynamic schemas)Includes a strong Powerful, flexible Sharding and query language indexing (including replication (javascript) geospatial) Cross-Platform (many drivers )
  • 4. DemoONLINE TUTORIAL - TRY IT OUT
  • 5. Get MongoDB and Driver(s)• Quick download, zero install• Also get your driver (C# for us)
  • 6. Use 10gen Quick Reference Cards
  • 7. DemoQUICKSTART - SETUP MONGODB
  • 8. Starting up MongoDB
  • 9. Using the console
  • 10. Demo -- Using MongoVue
  • 11. Understanding MongoVue
  • 12. MongoDB in the Cloud - MongoLab
  • 13. Adding Data• Data must be in JSON format - converter• “Insert” CREATES a collection if needed
  • 14. DemoADDING DATA TO MONGODB
  • 15. Importing data…using MongoVue
  • 16. Viewing Collection Data
  • 17. DemoQUERY MONGODB DATA
  • 18. Using FindFind, Fields, Sort, Count, Skip, Limit, Visualize or Export
  • 19. Comparing…
  • 20. Simple Query Translations
  • 21. More Query Translations
  • 22. What is Grouping?• Similar to T-SQL ‘Group By’• Written in javascript
  • 23. About the Aggregation Framework• New in MongoDB 2.2• Layer on top to facilitate easier query-writing
  • 24. MapReduce in MongoDB Map Reduce Optional Post- • Transforms input • Transform ProcessingOptional Pre- and emits key => key/values to • Finalize Processing value pairs output via • Filters • These K/V pairs will aggregation be reduced
  • 25. Using MapReduce• Example: find the 2 closest cities in each country, except in United States• Using SQL Server (T-SQL) vs.• Using MongoDB (MapReduce in JavaScript)
  • 26. MapReduce in MongoVue - I
  • 27. MapReduce in MongoVue - II
  • 28. DemoMAPREDUCE IN MONGODB
  • 29. What is GridFS?• Used to hold objects larger than 4 MB
  • 30. DemoUSING GRIDFS
  • 31. Data Visualization
  • 32. Modifying DataUpdate Update w/ $set Update w/ $inc• alone does a replace • does an update • increments Upserts Multiple field • must be enabled updates • then insert if • occur by default new, update if existing
  • 33. Update Query Translations
  • 34. Using Update
  • 35. Modeling Use GridFS for BLOBs Keep collections smallUse short names • Can create non- default (narrower) key• each name is saved • Document size for each document maximum is 16 MB• can save up to 30% storage
  • 36. What about Joins? Can use Arrays No Can De-normalize traditional Can use Embedded schema joins in Documents MongoDB Can use DBRef
  • 37. Understanding Explain• Query execution detail plan• Review number of scanned objects
  • 38. DemoADD INDEXES TO MONGODB
  • 39. Index Tuning Best Practices • Non _id • Add columns to index (specificity) Create best indexes • Multiple columns, most specific first • Based on query workloads Test newindexes for use
  • 40. DemoCONNECTING TO MONGODB WITHC#
  • 41. Programming against MongoDB
  • 42. DB Features for MongoDB & SQL Serverprimary keys and indexes queries with models for sorting / limiting results a strong typing system aggregations like SUM(), COUNT(), etc… Geospatial or Text search
  • 43. DB Features unique to Document DBs Collections • not Tables Query language • not T-SQL Idrefs • not JoinsNo pre-defined Schema • Nesting is common • Aggregation Framework Aggregations • Grouping or MapReduce • Within same document Transactions • No multi-document transactions
  • 44. DB Features of note in MongoDB• BSON supports more complex types (date, geo-spatial, etc…)• Supports dynamic queries via proprietary query language – Uses “find()” which returns a *lazy+ cursor – Multi-key indexes can be created• Role-based and Kerberos Security• Scalability via Replication/Sharding – including hashed sharding
  • 45. Why use MongoDB?Data Structure• Document-like• Semi-structured• Few Joins• GeospatialData Volume• Large or Huge• Distributed• Unpredictable
  • 46. MongoDB Scenarios Document E-commerce Archiving / Management (catalog portion event logging systems only) Real timeanalytics (based Gaming Geospatial on logging) Mobile
  • 47. More Information• MongoDB – http://www.mongodb.org• 10gen – http://www.10gen.com/contact – info@10gen.com• YouTube videos (from Lynn Langit) – MongoDB Playlist - https://www.youtube.com/playlist?list=PLCE5902FB1D284880& feature=view_all• MongoDB LA UG - http://www.meetup.com/Los-Angeles- MongoDB-User-Group
  • 48. The Changing Data Landscape Other ServicesRDBMS NoSQL
  • 49. • recipes)www.TeachingKidsProgramming.org• Free Courseware (• Do a Recipe  Teach a Kid (Ages 10 ++)• Java or Microsoft SmallBasic 
  • 50. Toward Data Craftsmanship… Follow me @LynnLangit RSS my blog www.LynnLangit.com Hire me • To help build your BI/Big Data solution • To teach your team next gen BI • To learn more about using NoSQL solutions