Accessing data with MongoDb
In this recipe, we access data with MongoDB, a NoSQL database.
Getting ready
We will use VS 2017 with ASP.NET Core.
To access the data, we will first install MongoDB locally. After that, we will install a Node.js module called AdminMongo to provide us with an interface to see and manage mongo data via a graphic interface and then, after creating some data, we will consume it in an ASP.NET Core application.
How to do it...
- First, we download the MongoDB Community version from the official website at https://www.mongodb.com/download-center#community and double-click on the
.msi
file:
- Let's specify an installation directory and choose the custom installation option:
- Next, we create the directory where we will store the data. By default, we have to create the
/data/db
folder inside theMongoDB
directory we choose when we install it. We also have to create/log/mongo-server.log
in theMongoDB
directory. - After that, we will create our MongoDB configuration file. Let's create...