Using MongoDB with ASP.NET MVC

MongoDB is quickly becoming a ubiquitous alternative to traditional relational storage systems. This course will give you the knowledge necessary to get started with MongoDB in your ASP.NET MVC applications and .NET development.
Course info
Rating
(532)
Level
Intermediate
Updated
Apr 4, 2014
Duration
3h 12m
Table of contents
Course Introduction
Connecting to MongoDB
Creating Documents
Storing and Modifying Documents
Querying Documents
GridFS
Next Steps
Description
Course info
Rating
(532)
Level
Intermediate
Updated
Apr 4, 2014
Duration
3h 12m
Description

Interested in using MongoDB to store information in your ASP.NET MVC applications? This course covers the decisions you will face and the tools available to incrementally build an MVC application with MongoDB. You will learn how to connect to MongoDB using the official C# driver, create documents and customize serialization, overcome the object relational impedance mismatch and start creating rich domain models, store and modify documents, query documents with both LINQ and Mongo query styles, and store files with GridFS. At the end of this course, you will have the skills necessary to begin using MongoDB in your .NET applications.

About the author
About the author

Wes Higbee is passionate about helping companies achieve remarkable results with technology and software. He’s had extensive experience developing software and working with teams to improve how software is developed to meet business objectives. Wes launched Full City Tech to leverage his expertise to help companies delight customers.

More from the author
What Is DevOps: Executive Briefing
Beginner
22m
Nov 2, 2018
Implementing a Self-hosted Docker Registry
Intermediate
4h 8m
Jun 5, 2018
Webpack: Transpiling and Bundling JavaScript
Intermediate
4h 55m
Jan 30, 2018
More courses by Wes Higbee
Section Introduction Transcripts
Section Introduction Transcripts

Course Introduction
The age of polyglot persistence has begun. NoSQL solutions like MongoDB are offering new opportunities to greatly simplify how we store and interact with our data. Hi. Welcome to Pluralsight. My name is Wes McClure. In this course, we're going to analyze how to use MongoDB in an ASP. NET MVC application to help you leverage this new opportunity. MongoDB is from a family of emerging NoSQL, or Not Only SQL databases. It's a database where information is no longer stored in rows, but rather in rich documents. In developing modern web applications, you've likely used JSON a time or two. MongoDB uses BSON, very similar to JSON, to store documents. If you're familiar with JSON, Mongo's document structure will feel very natural.

Connecting to MongoDB
Hello, I'm Wes McClure. In this module, we're going to cover how to connect to Mongo from your MVC applications. In order to do that, I'll talk about the official driver and other historical drivers in the. NET space. We'll look at how to install the driver via NuGet, ZIP, and MSI installers, and, since this module is about connecting to MongoDB, we'll explore the components in the driver to connect to a MongoDB server. In this course, we'll be building an MVC application to post real estate rentals, and then allow potential renters to search the rentals. We'll start this application by learning how to connect to a new real estate database in Mongo, we'll do a quick check of our connection by returning some build information, and last, I'll introduce a way to isolate the components to connect to a Mongo server so they're easier to reuse in your application.

Creating Documents
Hello. I'm Wes McClure. In the last module, we looked at how to connect to a Mongo server. The next logical thing we want to do is learn how to store documents. But before we can store documents, we need to look at how we can create documents in our. NET applications. In this module, we're going to briefly look at what a document is, we'll explore the two primary styles to create documents with the. NET driver, BsonDocument and POCOs. By the way, POCO stands for Plain Old CLR Object. Document serialization is the process whereby we turn POCOs into documents. We'll spend some time discussing how to customize this process, how to unit test our customizations, and how we can leverage POCOs to build rich models in our applications now that we've cast away the shackles of the object relational impedance mismatch. Finally, we'll solidify the concepts of creating documents by creating a rental listing model that we'll use throughout the course.

Next Steps
Hi, I'm Wes McClure. I hope you enjoyed the course. At this point, you may be wondering what you should do next to get started with MongoDB in your day to day development. In this module, I'm going to do a quick recap of what we learned, and then show you a few directions you can investigate to learn more. As promised, you now know how to build an MVC application using MongoDB. As we saw, documents provide a very flexible mechanism to store rentals, to modify them, and to remove them. Querying documents is often as simple as using LINQ, but Mongo also provides query documents and the aggregation framework to create sophisticated, highly performant queries of documents. We also saw how easy it is to store files with GridFS, allowing you to avoid the nuances of platform-specific file storage. I hope you take away from the course how simple it is to map objects to documents to easily store data with MongoDB. This should open the door for you to build much more rich, object-oriented models in your applications.