Your SlideShare is downloading. ×
0
MongoDB for the SQL Server Pro            Lynn Langit                           Feb 2013 – For MongoDB LA
What is MongoDB?•   Open source NoSQL database•   Document-oriented•   Stores JSON-like documents (dynamic schemas)•   Inc...
DemoQUICKSTART - SETUP MONGODB
Get MongoDB and Driver(s)• Quick download, zero install• Also get your driver (C# for us)
Starting up MongoDB
Using the Console
Using MongoVue
Connecting with MongoVue
Using MongoVue
Understanding more..COMPARING DOCUMENTDATABASES TO RDBMS SYSTEMS
So which type of NoSQL? CAP…                                                      CA = SQL/RDBMSCP = noSQL/column         ...
DB Features for MongoDB & SQL Server               Large object        primary keys                 support           and ...
DB Features unique to Document DBs Collections, not Tables Query language, not T-SQL Idrefs, not Joins No pre-defined Sche...
Use 10gen Quick Reference Cards
DB Features of note in MongoDB• BSON supports more complex types (date, geo-spatial, etc…)• Supports dynamic queries via p...
Why use MongoDB?Data Structure• Document-like• Semi-structured• Few Joins• GeospatialData Volume• Large or Huge• Distribut...
MongoDB Scenarios  Document           E-commerce                                       Archiving / Management        (cata...
DemoIMPORTING DATA TO MONGODB
Adding Data• Data must be in JSON format - converter• “Insert” CREATES a collection if needed
Importing data…using MongoVue
Viewing Collection Data
DemoUSING VELOCITY FOR MODELING
Modeling                                                      Use GridFS for                                              ...
Comparing…
DemoQUERY MONGODB DATA
Using FindFind, Fields, Sort, Count, Skip, Limit, Visualize or Export
Data Visualization
Queries
Queries 2 …
Queries 3…
What is Grouping?• Similar to T-SQL ‘Group By’• Written in javascript
What about Joins?               Can use                Arrays                No Can De-normalize            traditional   ...
About the Aggregation Framework• New in MongoDB 2.2• Layer on top to facilitate easier query-writing
Query Tuning• Use best indexes  – Evaluate use of _id  – Add columns to index (specificity)  – Multiple columns, most spec...
Understanding Explain• Query execution detail plan• Review number of scanned objects
Understanding moreADD INDEXES TO MONGODB
Modifying DataUpdate                       Update w/ $set             Update w/ $inc• alone does a replace       • does an...
Using Update
Understanding more…USING GRIDFS
What is GridFS?• Used to hold objects larger than 16 MB
DemoCONNECTING TO MONGODB WITH C#
Programming against MongoDB
More Information• MongoDB   – http://www.mongodb.org• 10gen   – http://www.10gen.com/contact   – info@10gen.com• YouTube v...
The Changing Data Landscape                             Other                            ServicesRDBMS           NoSQL
• recipes)www.TeachingKidsProgramming.org•   Free Courseware (•   Do a Recipe  Teach a Kid (Ages 10 ++)•   Java or Micros...
Toward Data Craftsmanship…                 Follow me @LynnLangit                      RSS my blog                   www.Ly...
Upcoming SlideShare
Loading in...5
×

MongoDB for the SQL Server Pro

1,621

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,621
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
44
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Source - http://www.10gen.com/what-is-mongodb
  • https://www.youtube.com/watch?v=k2YFy5IQu1M
  • http://www.mongodb.org/downloadshttps://github.com/mongodb/mongo-csharp-driver/downloads
  • http://www.mongovue.com/
  • http://amitpiplani.blogspot.com/2010/05/u-pick-2-selection-for-nosql-providers.html
  • http://docs.mongodb.org/manual/faq/developers/#how-do-i-do-transactions-and-locking-in-mongodb
  • http://www.10gen.com/reference
  • http://www.mongodb.org/display/DOCS/Use+Cases
  • http://www.mongodb.org/display/DOCS/Use+Cases
  • Free conversion (CSV to JSON) - http://www.cparker15.com/code/utilities/csv-to-json/
  • http://rickosborne.org/download/SQL-to-MongoDB.pdf
  • http://www.mongovue.com/2010/06/29/find/
  • 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://www.mongovue.com/2010/09/14/updating-collections/
  • 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()
  • https://www.youtube.com/watch?v=NCp4n6xWw68
  • http://www.youtube.com/watch?v=NCp4n6xWw68
  • Lynn
  • Transcript of "MongoDB for the SQL Server Pro"

    1. 1. MongoDB for the SQL Server Pro Lynn Langit Feb 2013 – For MongoDB LA
    2. 2. What is MongoDB?• Open source NoSQL database• Document-oriented• Stores JSON-like documents (dynamic schemas)• Includes a strong query language (javascript)• Powerful, flexible indexing (including geospatial)• Sharding and replication• Cross-Platform (many drivers )
    3. 3. DemoQUICKSTART - SETUP MONGODB
    4. 4. Get MongoDB and Driver(s)• Quick download, zero install• Also get your driver (C# for us)
    5. 5. Starting up MongoDB
    6. 6. Using the Console
    7. 7. Using MongoVue
    8. 8. Connecting with MongoVue
    9. 9. Using MongoVue
    10. 10. Understanding more..COMPARING DOCUMENTDATABASES TO RDBMS SYSTEMS
    11. 11. So which type of NoSQL? CAP… CA = SQL/RDBMSCP = noSQL/column SQL Sever / SQLHadoop AzureBig Table OracleH-base MySQLMemCacheDB(graph)? Consistency Availability AP = noSQL/document or key/value Partition MongoDB DynamoDB Tolerance CouchDB Cassandra Voldemort
    12. 12. DB Features for MongoDB & SQL Server Large object primary keys support and indexes aggregations queries with like models for SUM(), COUNT sorting / (), etc… limiting results a strong typing system
    13. 13. DB Features unique to Document DBs Collections, not Tables Query language, not T-SQL Idrefs, not Joins No pre-defined Schema Aggregations • Aggregation Framework • Grouping or MapReduce No Transactions • No multi-document transactions No Full-text search
    14. 14. Use 10gen Quick Reference Cards
    15. 15. 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• Scalability via Replication and Sharding
    16. 16. Why use MongoDB?Data Structure• Document-like• Semi-structured• Few Joins• GeospatialData Volume• Large or Huge• Distributed• Unpredictable
    17. 17. MongoDB Scenarios Document E-commerce Archiving / Management (catalog portion event logging systems only) Real timeanalytics (based Gaming Geospatial on logging) Mobile
    18. 18. DemoIMPORTING DATA TO MONGODB
    19. 19. Adding Data• Data must be in JSON format - converter• “Insert” CREATES a collection if needed
    20. 20. Importing data…using MongoVue
    21. 21. Viewing Collection Data
    22. 22. DemoUSING VELOCITY FOR MODELING
    23. 23. Modeling Use GridFS for BLOBs Keep collections smallUse short names • Can create non- default (narrower) key• each name is saved for • Document size each document maximum is 4 MB• can save up to 30% storage
    24. 24. Comparing…
    25. 25. DemoQUERY MONGODB DATA
    26. 26. Using FindFind, Fields, Sort, Count, Skip, Limit, Visualize or Export
    27. 27. Data Visualization
    28. 28. Queries
    29. 29. Queries 2 …
    30. 30. Queries 3…
    31. 31. What is Grouping?• Similar to T-SQL ‘Group By’• Written in javascript
    32. 32. What about Joins? Can use Arrays No Can De-normalize traditional Can use Embedded schema joins in Documents MongoDB Can use DBRef
    33. 33. About the Aggregation Framework• New in MongoDB 2.2• Layer on top to facilitate easier query-writing
    34. 34. Query Tuning• Use best indexes – Evaluate use of _id – Add columns to index (specificity) – Multiple columns, most specific first – Can use fully covered indexing (indexOnly:true) – Test to make sure indexes are being used• Qty scanned s/b same as QTY returned• Use .explain
    35. 35. Understanding Explain• Query execution detail plan• Review number of scanned objects
    36. 36. Understanding moreADD INDEXES TO MONGODB
    37. 37. 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
    38. 38. Using Update
    39. 39. Understanding more…USING GRIDFS
    40. 40. What is GridFS?• Used to hold objects larger than 16 MB
    41. 41. DemoCONNECTING TO MONGODB WITH C#
    42. 42. Programming against MongoDB
    43. 43. 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
    44. 44. The Changing Data Landscape Other ServicesRDBMS NoSQL
    45. 45. • recipes)www.TeachingKidsProgramming.org• Free Courseware (• Do a Recipe  Teach a Kid (Ages 10 ++)• Java or Microsoft SmallBasic 
    46. 46. 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
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×