Reading and writing data to MongoDB

In this section, we will have a look at how to read a list of work items from the MongoDB database and also how to insert a new work item into the database. I call them work items, because a work item can be a task or a bug. This can be done by performing the following steps:

  1. In the Models folder, create a new class called WorkItem, as shown in the following screenshot:
  1. Add the following code to the WorkItem class. You will notice that Id is of type ObjectId. This represents the unique identifier in the MondoDB document that gets created.
You need to ensure that you add the following using statement ...

Get C# 7 and .NET Core 2.0 Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.