SlideShare a Scribd company logo
1 of 24
+ Using MongoDB on Windows with the .Net Framework and C#
Let me introduce myself… Stefano Paluello All around geek   @ Barcrest Group & Pastesoft stefano.paluello@gmail.com stefanopaluello.wordpress.com Twitter: @palutz http://www.pastesoft.com
What is MongoDB? It’s an open source document oriented database: Full index support Replication & High Availability Scalable (auto-sharding) High performance (written in C++, atomic update,…) Rich query support Map/Reduce GridFS (store files without problem) Commercial support
Setting up MongoDB on Windows Download your version (better the 64bit Production release) from the official website: http://www.mongodb.org/downloads
Running MongoDB server… Best place where to look at (Windows quickstart): http://www.mongodb.org/display/DOCS/Quickstart+Windows Unzip, create log and data dir, run it 
Ok. Are we running? Let’s connect to the shell and check it $mongodirinongo.exe
MongoDB can run as service Official guide: http://www.mongodb.org/display/DOCS/Windows+Service Easy way:  $mongodirinongod  –install Let’s add some “flavour”: $mongodirinongod --logpath .ogogs --logappend --dbpath .ata –directoryperdb –install To manage it, NET START mongos, NET STOP mongos
MongoDB C#/.Net driver Official, high performance, fully featured C# driver supported by 10gen Now at version 1.2 Built and tested against MongoDB 1.8.3 e 2.0.0 on : Visual Studio 2008, Visual Studio 2010 MonoDevelop 2.6 (Mono 2.10) It can be downloaded from github.com: 	http://github.com/mongodb/mongo-csharp-driver NuGet: PM> Install-Package mongocsharpdriver http://www.nuget.org/List/Packages/mongocsharpdriver
MongoDB C#/.Net driver on NuGet
MongoDB C#/.Net driver Two main (separated) assemblies: MongoDB.Bson.dll MongoDB.Driver.dll (you can use other drivers) Namespaces (required) MongoDB.Bson; MongoDB.Driver; Namespace (additional)  MongoDB.Bson.IO, MongoDB.Bson.Serialization; MongoDB.Bson.Serialization.*, MongoDB.Driver.GridFs
BSON Namespace Represent the BSON Object Model A set of classes that handle all the specification of BSON documents (I/O, serialization, in-memory object model) Main classes: BsonDocument BsonElement BsonValue (abstract class), with BsonTypeenum property BsonArray BsonDateTime BsonDocument BsonInt32 BsonObjectId BsonString
BSON Object Model BsonDocument is the main class BsonDocument is a collection of elements (BsonElements ) BsonElement is a name/value pair where the value is a BsonValue (with its own BsonType) The BsonElement class is seldom used directly cause it’s created as needed implicitly: document.Add(new BsonElement(“Name”, “Stefano”)); document.Add(“Name”, “Stefano”));
MongoDB.Driver Main classes (all thread-safe): MongoServer MongoDatabase MongoCollection<TDocument> MongoCursor<Tdocument> (only when frozen) MongoServersrv = MongoServer.Create(); Every URL has a MongoServer instance (different Create calls with the same URL return with the same MongoServer instance NOT put in the session state (NOT serializable)
MongoDB.Driver MongoServersrv = MongoServer.Create(); Every URL has a MongoServer instance  different Create() calls with the same URL return with the same MongoServerinstance Do NOT put in the session state (NOT serializable) The driver manage a Connection Pools (one Connection Pools for every server) The connections are shared with all threads
MongoDB Driver MongoCollection : The class manages a collection of BsonDocument in a MongoDB database MongoCollection<TDefaultDocument>: Manage a collection of document, with the default type specified by the TDefaultDocument parameter GetCollection
MongoCollection class CRUD with Mongo – Query a collection FindOne and FindOneAs<T> IMongoQuery objects (QueryComplete) Find(query)
MongoCollection class CRUD with MongoDB - Insert There are many ways to insert data into a MongoDB collection (using the BsonDocument or any object that can be serialized
MongoCollection class CRUD with MongoDB – Update and Save There are many ways to update a document
MongoCollection class CRUD with MongoDB – Delete There are many ways to delete a Document
Let’s play a bit with the code…
Useful (IMHO) tools
MongoVue (www.mongovue.com)
Chrome Webstore – Mongo Live
Another code demo Get dynamics with C#

More Related Content

What's hot

Dealing with Azure Cosmos DB
Dealing with Azure Cosmos DBDealing with Azure Cosmos DB
Dealing with Azure Cosmos DBMihail Mateev
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger InternalsNorberto Leite
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and OptimizationPgDay.Seoul
 
Data infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companiesData infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companiesMartin Loetzsch
 
MongoDB World 2015 - A Technical Introduction to WiredTiger
MongoDB World 2015 - A Technical Introduction to WiredTigerMongoDB World 2015 - A Technical Introduction to WiredTiger
MongoDB World 2015 - A Technical Introduction to WiredTigerWiredTiger
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
Webinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBWebinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBMongoDB
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architectureBishal Khanal
 
State management in Structured Streaming
State management in Structured StreamingState management in Structured Streaming
State management in Structured Streamingdatamantra
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBLee Theobald
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptxSurya937648
 
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...Darshankumar Prajapati
 
Migrating from RDBMS to MongoDB
Migrating from RDBMS to MongoDBMigrating from RDBMS to MongoDB
Migrating from RDBMS to MongoDBMongoDB
 
mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교Woo Yeong Choi
 
Introduction to NOSQL databases
Introduction to NOSQL databasesIntroduction to NOSQL databases
Introduction to NOSQL databasesAshwani Kumar
 
Tuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBaseTuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBaseAnil Gupta
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 

What's hot (20)

Dealing with Azure Cosmos DB
Dealing with Azure Cosmos DBDealing with Azure Cosmos DB
Dealing with Azure Cosmos DB
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
Data infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companiesData infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companies
 
MongoDB World 2015 - A Technical Introduction to WiredTiger
MongoDB World 2015 - A Technical Introduction to WiredTigerMongoDB World 2015 - A Technical Introduction to WiredTiger
MongoDB World 2015 - A Technical Introduction to WiredTiger
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
CouchDB
CouchDBCouchDB
CouchDB
 
Webinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBWebinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDB
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
State management in Structured Streaming
State management in Structured StreamingState management in Structured Streaming
State management in Structured Streaming
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
ODI 11g - Multiple Flat Files to Oracle DB Table by taking File Name dynamica...
 
Migrating from RDBMS to MongoDB
Migrating from RDBMS to MongoDBMigrating from RDBMS to MongoDB
Migrating from RDBMS to MongoDB
 
mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교
 
Introduction to NOSQL databases
Introduction to NOSQL databasesIntroduction to NOSQL databases
Introduction to NOSQL databases
 
Tuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBaseTuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBase
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Schema Design
Schema DesignSchema Design
Schema Design
 

Similar to Using MongoDB on Windows with the .Net Framework and C

MongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutionMongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutioniFour Technolab Pvt. Ltd.
 
Introduction to MongoDB with PHP
Introduction to MongoDB with PHPIntroduction to MongoDB with PHP
Introduction to MongoDB with PHPfwso
 
Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.Rich Helton
 
Migrating from MySQL to MongoDB at Wordnik
Migrating from MySQL to MongoDB at WordnikMigrating from MySQL to MongoDB at Wordnik
Migrating from MySQL to MongoDB at WordnikTony Tam
 
From MySQL to MongoDB at Wordnik (Tony Tam)
From MySQL to MongoDB at Wordnik (Tony Tam)From MySQL to MongoDB at Wordnik (Tony Tam)
From MySQL to MongoDB at Wordnik (Tony Tam)MongoSF
 
MongoDB on Windows Azure
MongoDB on Windows AzureMongoDB on Windows Azure
MongoDB on Windows AzureMongoDB
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEANTroy Miles
 
Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)MongoSF
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introductionsethfloydjr
 
Introduction to MongoDB (Webinar Jan 2011)
Introduction to MongoDB (Webinar Jan 2011)Introduction to MongoDB (Webinar Jan 2011)
Introduction to MongoDB (Webinar Jan 2011)MongoDB
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBMongoDB
 
Introduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genIntroduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genMongoDB
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Dbchriskite
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBChun-Kai Wang
 
Windows Azure Web Sites - Things they don’t teach kids in school - Comunity D...
Windows Azure Web Sites- Things they don’t teach kids in school - Comunity D...Windows Azure Web Sites- Things they don’t teach kids in school - Comunity D...
Windows Azure Web Sites - Things they don’t teach kids in school - Comunity D...Maarten Balliauw
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsMongoDB
 

Similar to Using MongoDB on Windows with the .Net Framework and C (20)

MongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutionMongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & Execution
 
Introduction to MongoDB with PHP
Introduction to MongoDB with PHPIntroduction to MongoDB with PHP
Introduction to MongoDB with PHP
 
Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.
 
Migrating from MySQL to MongoDB at Wordnik
Migrating from MySQL to MongoDB at WordnikMigrating from MySQL to MongoDB at Wordnik
Migrating from MySQL to MongoDB at Wordnik
 
From MySQL to MongoDB at Wordnik (Tony Tam)
From MySQL to MongoDB at Wordnik (Tony Tam)From MySQL to MongoDB at Wordnik (Tony Tam)
From MySQL to MongoDB at Wordnik (Tony Tam)
 
MongoDB on Windows Azure
MongoDB on Windows AzureMongoDB on Windows Azure
MongoDB on Windows Azure
 
Mongo learning series
Mongo learning series Mongo learning series
Mongo learning series
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
 
Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)Java Development with MongoDB (James Williams)
Java Development with MongoDB (James Williams)
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
 
Introduction to MongoDB (Webinar Jan 2011)
Introduction to MongoDB (Webinar Jan 2011)Introduction to MongoDB (Webinar Jan 2011)
Introduction to MongoDB (Webinar Jan 2011)
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Introduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genIntroduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10gen
 
Intro To Mongo Db
Intro To Mongo DbIntro To Mongo Db
Intro To Mongo Db
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB Tutorials
 
How do i Meet MongoDB
How do i Meet MongoDBHow do i Meet MongoDB
How do i Meet MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Windows Azure Web Sites - Things they don’t teach kids in school - Comunity D...
Windows Azure Web Sites- Things they don’t teach kids in school - Comunity D...Windows Azure Web Sites- Things they don’t teach kids in school - Comunity D...
Windows Azure Web Sites - Things they don’t teach kids in school - Comunity D...
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 

More from Stefano Paluello

Real scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the CloudReal scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the CloudStefano Paluello
 
A gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and HadoopA gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and HadoopStefano Paluello
 
TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010Stefano Paluello
 
Teamwork and agile methodologies
Teamwork and agile methodologiesTeamwork and agile methodologies
Teamwork and agile methodologiesStefano Paluello
 

More from Stefano Paluello (10)

Clinical Data and AI
Clinical Data and AIClinical Data and AI
Clinical Data and AI
 
Real scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the CloudReal scenario: moving a legacy app to the Cloud
Real scenario: moving a legacy app to the Cloud
 
A gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and HadoopA gentle introduction to the world of BigData and Hadoop
A gentle introduction to the world of BigData and Hadoop
 
Grandata
GrandataGrandata
Grandata
 
How to use asana
How to use asanaHow to use asana
How to use asana
 
Windows Azure Overview
Windows Azure OverviewWindows Azure Overview
Windows Azure Overview
 
TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
 
Teamwork and agile methodologies
Teamwork and agile methodologiesTeamwork and agile methodologies
Teamwork and agile methodologies
 

Recently uploaded

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Using MongoDB on Windows with the .Net Framework and C

  • 1. + Using MongoDB on Windows with the .Net Framework and C#
  • 2. Let me introduce myself… Stefano Paluello All around geek  @ Barcrest Group & Pastesoft stefano.paluello@gmail.com stefanopaluello.wordpress.com Twitter: @palutz http://www.pastesoft.com
  • 3. What is MongoDB? It’s an open source document oriented database: Full index support Replication & High Availability Scalable (auto-sharding) High performance (written in C++, atomic update,…) Rich query support Map/Reduce GridFS (store files without problem) Commercial support
  • 4. Setting up MongoDB on Windows Download your version (better the 64bit Production release) from the official website: http://www.mongodb.org/downloads
  • 5. Running MongoDB server… Best place where to look at (Windows quickstart): http://www.mongodb.org/display/DOCS/Quickstart+Windows Unzip, create log and data dir, run it 
  • 6. Ok. Are we running? Let’s connect to the shell and check it $mongodirinongo.exe
  • 7. MongoDB can run as service Official guide: http://www.mongodb.org/display/DOCS/Windows+Service Easy way: $mongodirinongod –install Let’s add some “flavour”: $mongodirinongod --logpath .ogogs --logappend --dbpath .ata –directoryperdb –install To manage it, NET START mongos, NET STOP mongos
  • 8. MongoDB C#/.Net driver Official, high performance, fully featured C# driver supported by 10gen Now at version 1.2 Built and tested against MongoDB 1.8.3 e 2.0.0 on : Visual Studio 2008, Visual Studio 2010 MonoDevelop 2.6 (Mono 2.10) It can be downloaded from github.com: http://github.com/mongodb/mongo-csharp-driver NuGet: PM> Install-Package mongocsharpdriver http://www.nuget.org/List/Packages/mongocsharpdriver
  • 10. MongoDB C#/.Net driver Two main (separated) assemblies: MongoDB.Bson.dll MongoDB.Driver.dll (you can use other drivers) Namespaces (required) MongoDB.Bson; MongoDB.Driver; Namespace (additional) MongoDB.Bson.IO, MongoDB.Bson.Serialization; MongoDB.Bson.Serialization.*, MongoDB.Driver.GridFs
  • 11. BSON Namespace Represent the BSON Object Model A set of classes that handle all the specification of BSON documents (I/O, serialization, in-memory object model) Main classes: BsonDocument BsonElement BsonValue (abstract class), with BsonTypeenum property BsonArray BsonDateTime BsonDocument BsonInt32 BsonObjectId BsonString
  • 12. BSON Object Model BsonDocument is the main class BsonDocument is a collection of elements (BsonElements ) BsonElement is a name/value pair where the value is a BsonValue (with its own BsonType) The BsonElement class is seldom used directly cause it’s created as needed implicitly: document.Add(new BsonElement(“Name”, “Stefano”)); document.Add(“Name”, “Stefano”));
  • 13. MongoDB.Driver Main classes (all thread-safe): MongoServer MongoDatabase MongoCollection<TDocument> MongoCursor<Tdocument> (only when frozen) MongoServersrv = MongoServer.Create(); Every URL has a MongoServer instance (different Create calls with the same URL return with the same MongoServer instance NOT put in the session state (NOT serializable)
  • 14. MongoDB.Driver MongoServersrv = MongoServer.Create(); Every URL has a MongoServer instance different Create() calls with the same URL return with the same MongoServerinstance Do NOT put in the session state (NOT serializable) The driver manage a Connection Pools (one Connection Pools for every server) The connections are shared with all threads
  • 15. MongoDB Driver MongoCollection : The class manages a collection of BsonDocument in a MongoDB database MongoCollection<TDefaultDocument>: Manage a collection of document, with the default type specified by the TDefaultDocument parameter GetCollection
  • 16. MongoCollection class CRUD with Mongo – Query a collection FindOne and FindOneAs<T> IMongoQuery objects (QueryComplete) Find(query)
  • 17. MongoCollection class CRUD with MongoDB - Insert There are many ways to insert data into a MongoDB collection (using the BsonDocument or any object that can be serialized
  • 18. MongoCollection class CRUD with MongoDB – Update and Save There are many ways to update a document
  • 19. MongoCollection class CRUD with MongoDB – Delete There are many ways to delete a Document
  • 20. Let’s play a bit with the code…
  • 23. Chrome Webstore – Mongo Live
  • 24. Another code demo Get dynamics with C#

Editor's Notes

  1. Full index:Index on any attribute, just like you&apos;re used to.
  2. Full index:Index on any attribute, just like you&apos;re used to.
  3. Full index:Index on any attribute, just like you&apos;re used to.
  4. Full index:Index on any attribute, just like you&apos;re used to.
  5. Full index:Index on any attribute, just like you&apos;re used to.
  6. Full index:Index on any attribute, just like you&apos;re used to.
  7. Full index:Index on any attribute, just like you&apos;re used to.
  8. Full index:Index on any attribute, just like you&apos;re used to.
  9. Full index:Index on any attribute, just like you&apos;re used to.
  10. Full index:Index on any attribute, just like you&apos;re used to.
  11. Full index:Index on any attribute, just like you&apos;re used to.
  12. Full index:Index on any attribute, just like you&apos;re used to.
  13. Full index:Index on any attribute, just like you&apos;re used to.
  14. Full index:Index on any attribute, just like you&apos;re used to.
  15. Full index:Index on any attribute, just like you&apos;re used to.
  16. Full index:Index on any attribute, just like you&apos;re used to.
  17. Full index:Index on any attribute, just like you&apos;re used to.
  18. Full index:Index on any attribute, just like you&apos;re used to.
  19. Full index:Index on any attribute, just like you&apos;re used to.
  20. Full index:Index on any attribute, just like you&apos;re used to.
  21. Full index:Index on any attribute, just like you&apos;re used to.