Authorised Territory code examples - This .NET Web API C# tutorial shows how to read data from MongoDB collection in .NET minimal API.
First, we create the required models and entities in Visual Studio Web API project. MongoDB driver nuget package is installed and repo class added.
Next, connection string and collection name are added to the appsettings file followed by update to Program.cs file.
Finally, minimal API endpoints are added to read data from one MongoDB collection and AutoMapper is used to map fields to a DTO class. EndpointsExplorer is used for testing.