SlideShare a Scribd company logo
Introduction to MongoDB 
for C# developers 
by Taras Romanyk – rredcat@gmail.com 
http://www.linkedin.com/in/rredcat
What is it? 
● Document 
● Open source 
● High performance 
● Horizontally scalable
Terminology 
RDBMS MongoDB 
Table, View Collection 
Row Document 
Index Index 
Join Embedded Document 
Foreign Key Reference 
Partition Shard
What is it? 
BSON 
{ 
"_id": 
ObjectId("4efa8d2b7d284dad101e4bc7"), 
"Last Name": "PELLERIN", 
"First Name": "Franck", 
"Date of Birth": "09-19-1983", 
"Address": "1 chemin des Loges", 
"City": "VERSAILLES" 
}
CRUD 
{ _id: 1, highScore: 800, lowScore: 200 } 
● 16 MB limitation 
● GridFS (chunks, files) partly loading 
● $inc, $mul, $rename, $setOnInsert, 
$set,$unset, $min, $max, $currentDate
CRUD 
{ _id: 1, highScore: 800, lowScore: 200 } 
{ _id: 1, highScore: 800, lowScore: 200 } 
db.scores.update( 
{ _id: 1 }, 
{ $min: { lowScore: 150 } } 
)
Find/Aggregation 
Find 
db.inventory.find( { type: 'food', price: { $lt: 9.95 } } ) 
Aggregation 
$project, $match, $limit, $skip, $unwind, 
$group, $sort, $geoNear, $out, $redact 
$out 
$out
Find/Aggregation 
{"_id": "10", "city": "NEW YORK", "state": "NY", 
"pop": 5574} 
db.zipcodes.aggregate( 
{ $group :{ 
_id : { state : "$state", city : "$city" }, 
pop : { $sum : "$pop" } } }, 
{ $group : { 
_id : "$_id.state", 
avgCityPop : { $avg : "$pop" } 
} } )
MapReduce 
var map = 
"function() {" + 
" for (var key in this) {" + 
" emit(key, { count : 1 });" + 
" }" + 
"}"; 
var reduce = 
"function(key, emits) {" + 
" total = 0;" + 
" for (var i in emits) {" + 
" total += emits[i].count;" + 
" }" + 
" return { count : total };" + 
"}"; 
var mr = collection.MapReduce(map, reduce); 
foreach (var document in mr.GetResults()) { 
Console.WriteLine(document.ToJson()); 
}
Exmaple
Example
Example
Example
Q&A 
https://university.mongodb.com/courses 
http://docs.mongodb.org/manual/ 
http://www.10gen.com/presentations 
https://groups.google.com/forum/#!forum/mo 
ngodb-user 
http://stackoverflow.com/questions/tagged/m 
ongodb 
http://robomongo.org/

More Related Content

PPT
Meetup#1: 10 reasons to fall in love with MongoDB
PDF
Starting out with MongoDB
PPTX
Shankar's mongo db presentation
PDF
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
ODP
Как показать 90 млн картинок и сохранить жизнь диску
ODP
Как показать 90 млн картинок и сохранить жизнь диску
PPTX
Aggregation in MongoDB
Meetup#1: 10 reasons to fall in love with MongoDB
Starting out with MongoDB
Shankar's mongo db presentation
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Как показать 90 млн картинок и сохранить жизнь диску
Как показать 90 млн картинок и сохранить жизнь диску
Aggregation in MongoDB

What's hot (19)

TXT
Netcfg 122078
PPTX
Webinar: Exploring the Aggregation Framework
PDF
CouchDB Open Source Bridge
PDF
MongoDB Europe 2016 - Graph Operations with MongoDB
PDF
JSON Schema in Web Frontend #insideFE
PDF
03. ElasticSearch : Data In, Data Out
PDF
MongoUK - PHP Development
TXT
Netcfg 52244
PDF
MongoDB Europe 2016 - Advanced MongoDB Aggregation Pipelines
PDF
NOSQL: il rinascimento dei database?
KEY
Geolocalização com MongoDB e Rails
PDF
01 ElasticSearch : Getting Started
PPTX
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
PPTX
Aggregation Framework
TXT
Netcfg 122625
PDF
FrozenRails Training
PPTX
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
TXT
Netcfg 55536
PDF
Latinoware
Netcfg 122078
Webinar: Exploring the Aggregation Framework
CouchDB Open Source Bridge
MongoDB Europe 2016 - Graph Operations with MongoDB
JSON Schema in Web Frontend #insideFE
03. ElasticSearch : Data In, Data Out
MongoUK - PHP Development
Netcfg 52244
MongoDB Europe 2016 - Advanced MongoDB Aggregation Pipelines
NOSQL: il rinascimento dei database?
Geolocalização com MongoDB e Rails
01 ElasticSearch : Getting Started
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
Aggregation Framework
Netcfg 122625
FrozenRails Training
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
Netcfg 55536
Latinoware
Ad

Similar to Introduction to MongoDB for C# developers (20)

PPTX
Querying mongo db
PPTX
Webinar: General Technical Overview of MongoDB for Dev Teams
PDF
Aggregation Framework MongoDB Days Munich
PDF
Precog & MongoDB User Group: Skyrocket Your Analytics
PDF
Mongo db for C# Developers
PPTX
Introduction to MongoDB and Workshop
KEY
MongoDB - Introduction
PDF
NDC London 2013 - Mongo db for c# developers
PPTX
Mongo db 101 dc group
PPTX
Query Optimization in MongoDB
PPT
Mongodb
PPT
Fast querying indexing for performance (4)
PPTX
introtomongodb
PPTX
Introduction To MongoDB
PDF
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
ODP
MongoDB Distilled
PDF
Mongodb Aggregation Pipeline
PDF
MongoDB Meetup
PPT
Building Your First MongoDB App ~ Metadata Catalog
PPTX
lecture_40_1.pptx
Querying mongo db
Webinar: General Technical Overview of MongoDB for Dev Teams
Aggregation Framework MongoDB Days Munich
Precog & MongoDB User Group: Skyrocket Your Analytics
Mongo db for C# Developers
Introduction to MongoDB and Workshop
MongoDB - Introduction
NDC London 2013 - Mongo db for c# developers
Mongo db 101 dc group
Query Optimization in MongoDB
Mongodb
Fast querying indexing for performance (4)
introtomongodb
Introduction To MongoDB
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
MongoDB Distilled
Mongodb Aggregation Pipeline
MongoDB Meetup
Building Your First MongoDB App ~ Metadata Catalog
lecture_40_1.pptx
Ad

Recently uploaded (20)

PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ai tools demonstartion for schools and inter college
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Navsoft: AI-Powered Business Solutions & Custom Software Development
2025 Textile ERP Trends: SAP, Odoo & Oracle
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Digital Strategies for Manufacturing Companies
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Softaken Excel to vCard Converter Software.pdf
top salesforce developer skills in 2025.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Design an Analysis of Algorithms I-SECS-1021-03
How to Migrate SBCGlobal Email to Yahoo Easily
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ai tools demonstartion for schools and inter college
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Reimagine Home Health with the Power of Agentic AI​
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PTS Company Brochure 2025 (1).pdf.......
How to Choose the Right IT Partner for Your Business in Malaysia
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

Introduction to MongoDB for C# developers

  • 1. Introduction to MongoDB for C# developers by Taras Romanyk – rredcat@gmail.com http://www.linkedin.com/in/rredcat
  • 2. What is it? ● Document ● Open source ● High performance ● Horizontally scalable
  • 3. Terminology RDBMS MongoDB Table, View Collection Row Document Index Index Join Embedded Document Foreign Key Reference Partition Shard
  • 4. What is it? BSON { "_id": ObjectId("4efa8d2b7d284dad101e4bc7"), "Last Name": "PELLERIN", "First Name": "Franck", "Date of Birth": "09-19-1983", "Address": "1 chemin des Loges", "City": "VERSAILLES" }
  • 5. CRUD { _id: 1, highScore: 800, lowScore: 200 } ● 16 MB limitation ● GridFS (chunks, files) partly loading ● $inc, $mul, $rename, $setOnInsert, $set,$unset, $min, $max, $currentDate
  • 6. CRUD { _id: 1, highScore: 800, lowScore: 200 } { _id: 1, highScore: 800, lowScore: 200 } db.scores.update( { _id: 1 }, { $min: { lowScore: 150 } } )
  • 7. Find/Aggregation Find db.inventory.find( { type: 'food', price: { $lt: 9.95 } } ) Aggregation $project, $match, $limit, $skip, $unwind, $group, $sort, $geoNear, $out, $redact $out $out
  • 8. Find/Aggregation {"_id": "10", "city": "NEW YORK", "state": "NY", "pop": 5574} db.zipcodes.aggregate( { $group :{ _id : { state : "$state", city : "$city" }, pop : { $sum : "$pop" } } }, { $group : { _id : "$_id.state", avgCityPop : { $avg : "$pop" } } } )
  • 9. MapReduce var map = "function() {" + " for (var key in this) {" + " emit(key, { count : 1 });" + " }" + "}"; var reduce = "function(key, emits) {" + " total = 0;" + " for (var i in emits) {" + " total += emits[i].count;" + " }" + " return { count : total };" + "}"; var mr = collection.MapReduce(map, reduce); foreach (var document in mr.GetResults()) { Console.WriteLine(document.ToJson()); }
  • 14. Q&A https://university.mongodb.com/courses http://docs.mongodb.org/manual/ http://www.10gen.com/presentations https://groups.google.com/forum/#!forum/mo ngodb-user http://stackoverflow.com/questions/tagged/m ongodb http://robomongo.org/

Editor's Notes

  • #3: http://blog.michaelckennedy.net/2010/04/29/mongodb-vs-sql-server-2008-performance-showdown/ Consistency. All nodes see the same data at the same time. Availability. A guarantee that every request receives a response about whether it was successful or failed. Partition tolerance. The system continues to operate despite arbitrary message loss or failure of part of the system.
  • #6: { getLastError: 1 }
  • #7: { getLastError: 1 }
  • #8: var group = new BsonDocument { { "$group", new BsonDocument { { "_id", new BsonDocument { { "MyUser","$User" } } }, { "Count", new BsonDocument { { "$sum", 1 } } } } } };