MongoDB.MvcCore
1.0.9
dotnet add package MongoDB.MvcCore --version 1.0.9
NuGet\Install-Package MongoDB.MvcCore -Version 1.0.9
<PackageReference Include="MongoDB.MvcCore" Version="1.0.9" />
paket add MongoDB.MvcCore --version 1.0.9
#r "nuget: MongoDB.MvcCore, 1.0.9"
// Install MongoDB.MvcCore as a Cake Addin #addin nuget:?package=MongoDB.MvcCore&version=1.0.9 // Install MongoDB.MvcCore as a Cake Tool #tool nuget:?package=MongoDB.MvcCore&version=1.0.9
MongoDB.MvcCore
Serialization Extensions to MvcCore for using MongoDB
The MongoDB.MvcCore contains extensions to the MongDB framework where Json strings can be used as input and output can be deserialized to Json.
The deserializer can also be used as a pretty-print formatter. On console apps the pretty-print feature can ben colorized. However this is no strict Json.
The non-colorized Json output is 'valid' Json
The serializer can also be used in an MvcCore project which enables seemless integration of json output from a controller to a client.
using MongoDB.Driver;
using MongoDB.MvcCore;
var services = builder.Services;
var mongoclient = new MongoClient("mongodb://127.0.0.1:27017");
services.AddSingleton<IMongoClient>(mongoclient);
services
.AddMvcCore()
.AddBsonJsonConverters(); // Serialization in API controller
public class MongoController : ControllerBase
{
private readonly IMongoClient mongo;
public MongoController(IMongoClient mongoClient)
{
this.mongo = mongoClient;
}
[HttpGet]
[Route("~/api/ShowCollection")]
public async Task<IActionResult> ShowCollection()
{
var List = await mongo
.GetDatabase("demo")
.GetCollection("collection1")
.Find("{}")
.ToListAsync();
return Ok(new
{
List
});
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- MongoDB.Driver (>= 2.18.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.9 | 379 | 12/5/2022 |