In this section, we will have a look at how to read a list of work items from the MongoDB database and how to insert a new work item into the database (I use the term work item to refer to a task or a bug). This can be done by performing the following steps:
- In the Models folder, create a new class called WorkItem, as shown in the following screenshot:
- Add the following code to the WorkItem class. You will notice that Id is of the ObjectId type. This represents the unique identifier in the MongoDB document that gets created.
You need to ensure that you add the following using statement to your WorkItem class using MongoDB.Bson;.
Take a look at the following code:
public class WorkItem { public ObjectId Id { get; set; } public string Title { get; set; } public string Description { get; set; } public int Severity { get...