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

MongoDB for the .NET Developer

on

  • 6,513 views

 

Statistics

Views

Total Views
6,513
Slideshare-icon Views on SlideShare
5,018
Embed Views
1,495

Actions

Likes
8
Downloads
125
Comments
0

6 Embeds 1,495

http://lynnlangit.wordpress.com 1223
http://lynnlangit.com 268
http://us-w1.rockmelt.com 1
http://moodle.ivybridge.com 1
https://www.linkedin.com 1
https://tasks.crowdflower.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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

MongoDB for the .NET Developer MongoDB for the .NET Developer Presentation Transcript

  • MongoDB for the .NET Developer Lynn Langit Data Wrangler May 2012 – For NoSQL class
  • What We’ll Cover• What• Why• When and Where• How• How much
  • Section OneMONGODB BASICS
  • What is MongoDB?
  • 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 )
  • ActivityONLINE TUTORIAL - TRY IT OUT
  • 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
  • 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
  • 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…
  • 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
  • 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
  • Use 10gen Quick Reference Cards
  • Get MongoDB and Driver(s)• Quick download, zero install• Also get your driver (C# for us)
  • ActivitySETUP MONGODB
  • Starting up MongoDB
  • Using the console
  • Using MongoVue
  • Connecting with MongoVue
  • Using MongoVue
  • Adding Data• Data must be in JSON format - converter• “Insert” CREATES a collection if needed
  • Importing data…using MongoVue
  • ActivityADDING DATA TO MONGODB
  • Viewing Collection Data
  • Using FindFind, Fields, Sort, Count, Skip, Limit, Visualize or Export
  • Data Visualization
  • Understanding Explain• Query execution detail plan• Review number of scanned objects
  • 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
  • Using Update
  • Section TwoMONGODB PROGRAMMING
  • Comparing…
  • ActivityQUERY MONGODB DATA
  • Queries
  • Queries more
  • Queries 3…
  • What is Grouping?• Similar to T-SQL ‘Group By’• Written in javascript
  • 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)
  • Using MapReduce• Example: find the 2 closest cities in each country, except in United States• Using SQL Server (T-SQL) vs.• Using MongoDB (MapReduce)
  • MapReduce in MongoVue - I
  • MapReduce in MongoVue - II
  • ActivityMAPREDUCE IN MONGODB
  • What about Joins?• No traditional joins in MongoDB• Can use Arrays• Can use Embedded Documents• Can use DBRef• Can De-normalize schema
  • 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
  • How to Model• Using Velocity
  • 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
  • ActivityADD INDEXES TO MONGODB
  • What is GridFS?• Used to hold objects larger than 4 MB
  • ActivityUSING GRIDFS
  • Programming against MongoDB
  • ActivityCONNECTING TO MONGODB WITHC#
  • 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
  • The Changing Data Landscape Other ServicesRDBMS NoSQL
  • • recipes)www.TeachingKidsProgramming.org• Free Courseware (• Do a Recipe  Teach a Kid (Ages 10 ++)• Java or Microsoft SmallBasic 
  • 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