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

What's hot (19)

TXT
Netcfg 122078
다은 최
 
PPTX
Webinar: Exploring the Aggregation Framework
MongoDB
 
PDF
CouchDB Open Source Bridge
Chris Anderson
 
PDF
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB
 
PDF
JSON Schema in Web Frontend #insideFE
Hiroyuki Anai
 
PDF
03. ElasticSearch : Data In, Data Out
OpenThink Labs
 
PDF
MongoUK - PHP Development
Boxed Ice
 
TXT
Netcfg 52244
Queenofhearts Griffin
 
PDF
MongoDB Europe 2016 - Advanced MongoDB Aggregation Pipelines
MongoDB
 
PDF
NOSQL: il rinascimento dei database?
Paolo Bernardi
 
KEY
Geolocalização com MongoDB e Rails
Maurício Maia
 
PDF
01 ElasticSearch : Getting Started
OpenThink Labs
 
PPTX
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
MongoDB
 
PPTX
Aggregation Framework
MongoDB
 
TXT
Netcfg 122625
wcholfin
 
PDF
FrozenRails Training
Mike Dirolf
 
PPTX
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB
 
TXT
Netcfg 55536
Pernell Childers
 
PDF
Latinoware
kchodorow
 
Netcfg 122078
다은 최
 
Webinar: Exploring the Aggregation Framework
MongoDB
 
CouchDB Open Source Bridge
Chris Anderson
 
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB
 
JSON Schema in Web Frontend #insideFE
Hiroyuki Anai
 
03. ElasticSearch : Data In, Data Out
OpenThink Labs
 
MongoUK - PHP Development
Boxed Ice
 
Netcfg 52244
Queenofhearts Griffin
 
MongoDB Europe 2016 - Advanced MongoDB Aggregation Pipelines
MongoDB
 
NOSQL: il rinascimento dei database?
Paolo Bernardi
 
Geolocalização com MongoDB e Rails
Maurício Maia
 
01 ElasticSearch : Getting Started
OpenThink Labs
 
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
MongoDB
 
Aggregation Framework
MongoDB
 
Netcfg 122625
wcholfin
 
FrozenRails Training
Mike Dirolf
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB
 
Netcfg 55536
Pernell Childers
 
Latinoware
kchodorow
 

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

PPTX
Querying mongo db
Bogdan Sabău
 
PPTX
Webinar: General Technical Overview of MongoDB for Dev Teams
MongoDB
 
PDF
Aggregation Framework MongoDB Days Munich
Norberto Leite
 
PDF
Precog & MongoDB User Group: Skyrocket Your Analytics
MongoDB
 
PDF
Mongo db for C# Developers
Simon Elliston Ball
 
PPTX
Introduction to MongoDB and Workshop
AhmedabadJavaMeetup
 
KEY
MongoDB - Introduction
Vagmi Mudumbai
 
PDF
NDC London 2013 - Mongo db for c# developers
Simon Elliston Ball
 
PPTX
Mongo db 101 dc group
John Ragan
 
PPTX
Query Optimization in MongoDB
Hamoon Mohammadian Pour
 
PPT
Mongodb
Manav Prasad
 
PPT
Fast querying indexing for performance (4)
MongoDB
 
PPTX
introtomongodb
saikiran
 
PPTX
Introduction To MongoDB
Lee Theobald
 
PDF
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
NETWAYS
 
ODP
MongoDB Distilled
b0ris_1
 
PDF
Mongodb Aggregation Pipeline
zahid-mian
 
PDF
MongoDB Meetup
Maxime Beugnet
 
PPT
Building Your First MongoDB App ~ Metadata Catalog
hungarianhc
 
PPTX
lecture_40_1.pptx
RAGULNS1
 
Querying mongo db
Bogdan Sabău
 
Webinar: General Technical Overview of MongoDB for Dev Teams
MongoDB
 
Aggregation Framework MongoDB Days Munich
Norberto Leite
 
Precog & MongoDB User Group: Skyrocket Your Analytics
MongoDB
 
Mongo db for C# Developers
Simon Elliston Ball
 
Introduction to MongoDB and Workshop
AhmedabadJavaMeetup
 
MongoDB - Introduction
Vagmi Mudumbai
 
NDC London 2013 - Mongo db for c# developers
Simon Elliston Ball
 
Mongo db 101 dc group
John Ragan
 
Query Optimization in MongoDB
Hamoon Mohammadian Pour
 
Mongodb
Manav Prasad
 
Fast querying indexing for performance (4)
MongoDB
 
introtomongodb
saikiran
 
Introduction To MongoDB
Lee Theobald
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
NETWAYS
 
MongoDB Distilled
b0ris_1
 
Mongodb Aggregation Pipeline
zahid-mian
 
MongoDB Meetup
Maxime Beugnet
 
Building Your First MongoDB App ~ Metadata Catalog
hungarianhc
 
lecture_40_1.pptx
RAGULNS1
 
Ad

Recently uploaded (20)

PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Executive Business Intelligence Dashboards
vandeslie24
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Ad

Introduction to MongoDB for C# developers

  • 1. Introduction to MongoDB for C# developers by Taras Romanyk – [email protected] 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 } } } } } };