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:
- Add the following code to the
WorkItem
class. You will notice thatId
is of typeObjectId
. This represents the unique identifier in the MondoDB document that gets created.
Note
You need to ensure that you add the following using
statement to your WorkItem
class using MongoDB.Bson;
.
Take a look 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; set; } public string WorkItemType { get; set; } public string AssignedTo { get; set; } }
- Next,...