Your SlideShare is downloading. ×
MongoDB for the .NET Developer
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MongoDB for the .NET Developer

5,778

Published on

Published in: Technology
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,778
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
146
Comments
0
Likes
9
Embeds 0
No embeds

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
  • http://en.wikipedia.org/wiki/MongoDB
  • Source - http://www.10gen.com/what-is-mongodb
  • http://www.mongodb.org/display/DOCS/Use+Cases
  • http://amitpiplani.blogspot.com/2010/05/u-pick-2-selection-for-nosql-providers.html
  • http://www.10gen.com/reference
  • http://www.mongodb.org/downloadshttps://github.com/mongodb/mongo-csharp-driver/downloads
  • 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://www.mongovue.com/2010/09/14/updating-collections/
  • http://rickosborne.org/download/SQL-to-MongoDB.pdf
  • http://api.mongodb.org/wiki/current/Aggregation.html
  • 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
  • https://www.youtube.com/watch?v=au-4aYQWrjQ
  • 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.youtube.com/watch?v=NCp4n6xWw68
  • https://www.youtube.com/watch?v=NCp4n6xWw68
  • Lynn
  • Transcript

    • 1. MongoDB for the .NET Developer Lynn Langit Data Wrangler May 2012 – For NoSQL class
    • 2. What We’ll Cover• What• Why• When and Where• How• How much
    • 3. Section OneMONGODB BASICS
    • 4. What is MongoDB?
    • 5. 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 )
    • 6. ActivityONLINE TUTORIAL - TRY IT OUT
    • 7. Why use MongoDB?• When your source data is ‘document-like’ – i.e. Document Management systems – E-commerce (catalog portion only) – When your source data doesn’t require joins• Archiving / event logging – Real time analytics (based on logging)• Gaming – Geospatial – Mobile
    • 8. So which type of NoSQL? Back to CAP… CA = SQL/RDBMSCP = noSQL/column SQL Sever / SQLHadoop AzureBig Table OracleH-base MySQLMemCacheDB(graph)? Consistency Availability AP = noSQL/document or key/value MongoDB Partitioning DynamoDB CouchDB Cassandra Voldemort
    • 9. Relational & Document Models• Both systems support… – primary keys and indexes – queries with models for sorting / limiting results – a strong typing system – aggregations like SUM(), COUNT(), etc…
    • 10. Document Model Databases have…• No Tables• No T-SQL• No Joins• No pre-defined Schema• Aggregations via Grouping or MapReduce• No Transactions• No Full-text search
    • 11. Unique to MongoDB• BSON supports more complex types (date, geo-spatial, etc…)• Supports dynamic queries via proprietary query language – Uses “find()” which returns a *lazy+ cursor – Ex., “Db.posts.find().sort(,date:-1}).limit(10);” – Multi-key indexes can be created
    • 12. Use 10gen Quick Reference Cards
    • 13. Get MongoDB and Driver(s)• Quick download, zero install• Also get your driver (C# for us)
    • 14. ActivitySETUP MONGODB
    • 15. Starting up MongoDB
    • 16. Using the console
    • 17. Using MongoVue
    • 18. Connecting with MongoVue
    • 19. Using MongoVue
    • 20. Adding Data• Data must be in JSON format - converter• “Insert” CREATES a collection if needed
    • 21. Importing data…using MongoVue
    • 22. ActivityADDING DATA TO MONGODB
    • 23. Viewing Collection Data
    • 24. Using FindFind, Fields, Sort, Count, Skip, Limit, Visualize or Export
    • 25. Data Visualization
    • 26. Understanding Explain• Query execution detail plan• Review number of scanned objects
    • 27. Modifying Data• Update – alone does a replace• Update w/ $set – does an update• Update w/ $inc – increments• Upserts – must be enabled, then insert if new, update if existing• Multiple field updates occur by default
    • 28. Using Update
    • 29. Section TwoMONGODB PROGRAMMING
    • 30. Comparing…
    • 31. ActivityQUERY MONGODB DATA
    • 32. Queries
    • 33. Queries more
    • 34. Queries 3…
    • 35. What is Grouping?• Similar to T-SQL ‘Group By’• Written in javascript
    • 36. MapReduce in MongoDB• Written in JavaScript• Map – Transforms input and emits key => value pairs – These K/V pairs will be reduced• Reduce – Transform key/values to output via aggregation• Finalize (optional)• Filters (optional)
    • 37. Using MapReduce• Example: find the 2 closest cities in each country, except in United States• Using SQL Server (T-SQL) vs.• Using MongoDB (MapReduce)
    • 38. MapReduce in MongoVue - I
    • 39. MapReduce in MongoVue - II
    • 40. ActivityMAPREDUCE IN MONGODB
    • 41. What about Joins?• No traditional joins in MongoDB• Can use Arrays• Can use Embedded Documents• Can use DBRef• Can De-normalize schema
    • 42. Modeling• Use short names – each name is saved for each document, can save up to 30% storage• Keep collections small• Document size maximum is 4 MB• Use GridFS for BLOBs
    • 43. How to Model• Using Velocity
    • 44. Query Tuning• Use best indexes – Non _id – Add columns to index (specificity) – Mulitple columns, most specific first – Test to make sure indexes are being used• Qty scanned s/b same as QTY returned• Use .explain
    • 45. ActivityADD INDEXES TO MONGODB
    • 46. What is GridFS?• Used to hold objects larger than 4 MB
    • 47. ActivityUSING GRIDFS
    • 48. Programming against MongoDB
    • 49. ActivityCONNECTING TO MONGODB WITHC#
    • 50. 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
    • 51. The Changing Data Landscape Other ServicesRDBMS NoSQL
    • 52. • recipes)www.TeachingKidsProgramming.org• Free Courseware (• Do a Recipe  Teach a Kid (Ages 10 ++)• Java or Microsoft SmallBasic 
    • 53. 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

    ×