Becoming a software developer – episode XXI

Becoming a software developer – episode XXI

Welcome to the twenty-first episode of my course “Becoming a software developer” in which we will use MongoDB which is a NoSQL database for storing the data of our application.

All of the materials including videos and sample projects can be downloaded from here.
The source code repository is being hosted on GitHub.


 

Scope

  • MongoDB

Abstract

MongoDB

This is one of the most popular NoSQL databases in the world. Beware that NoSQL is just a catchy buzzword – there are many different NoSQL databases with totally unique behavior and destination. Basically, whenever you hear NoSQL, you should think about data storage where you can put the data in a so-called collection that does not require any particular schema and is very flexible. Quite often JSON is used as the primary data type for storing the documents. Opposite to the SQL database, usually, NoSQL databases do not handle transactions and reference keys. On the other hand, it’s quite simple to map even 1:1 class to the document stored within such database which makes them a very interesting choice as the primary data storage type for the variety of applications. To connect to the database, you can use Robomongo which is a free GUI client.

In order to start with MongoDB and .NET Core, it is required to install MongoDB.Driver. Once completed, we can create custom MongoSettings, configure the IoC module and implement the actual repository for the users:

Before we start using our brand new Mongo repository, let’s create so-called conventions and initialize them in a Startup class:

Eventually, we can secure the database by adding user to it and then fix the connection string property within the application settings:

Next

In the next episode, we will use the SQL Server and Entity Framework Core to store the data in a typical SQL Server database.

3 Comments Becoming a software developer – episode XXI

  1. Pingback: Dew Drop - June 15, 2017 (#2501) - Morning Dew

Leave A Comment

Your email address will not be published. Required fields are marked *