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:
![](https://static.packt-cdn.com/products/9781785886751/graphics/9c590a4a-41aa-47bd-92bc-5edec9032b82.png)
- Let's specify an installation directory and choose the custom installation option:
![](https://static.packt-cdn.com/products/9781785886751/graphics/78062ac5-0fc6-455e-8fd0-18b2b9c2a3d2.png)
- 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...