KitStack.Audit.Sinks.Mongo 0.1.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package KitStack.Audit.Sinks.Mongo --version 0.1.8
                    
NuGet\Install-Package KitStack.Audit.Sinks.Mongo -Version 0.1.8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KitStack.Audit.Sinks.Mongo" Version="0.1.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KitStack.Audit.Sinks.Mongo" Version="0.1.8" />
                    
Directory.Packages.props
<PackageReference Include="KitStack.Audit.Sinks.Mongo" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KitStack.Audit.Sinks.Mongo --version 0.1.8
                    
#r "nuget: KitStack.Audit.Sinks.Mongo, 0.1.8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package KitStack.Audit.Sinks.Mongo@0.1.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=KitStack.Audit.Sinks.Mongo&version=0.1.8
                    
Install as a Cake Addin
#tool nuget:?package=KitStack.Audit.Sinks.Mongo&version=0.1.8
                    
Install as a Cake Tool

KitStack.Audit.Sinks.Mongo

A MongoDB sink for KitStack.Audit, built on the official MongoDB.EntityFrameworkCore provider. It persists captured trails through a MongoAuditDbContext, mirroring the structure of the relational sink.

Wiring

services.AddKitStackAuditMongoSink(
    connectionString: configuration["Audit:Database:ConnectionString"]!,
    databaseName:     configuration["Audit:Database:DatabaseName"]!);

This registers MongoAuditDbContext (configured with UseMongoDB) and IAuditSink -> MongoAuditSink. GUIDs are stored as strings via a globally registered serializer (registered idempotently). Trails are written to the AuditTrails collection.

Note on storage shape

Because EF Core cannot map arbitrary value dictionaries, each TrailDto is flattened to an AuditTrail document whose value payloads (PreviousValues, NewValues, ModifiedProperties, PrimaryKey) are JSON strings — the same shape as the relational sink. If you need native embedded BSON sub-documents instead, use a raw MongoDB.Driver-based sink.

Behavior

  • Standalone MongoDB has no multi-document transactions, so the context uses AutoTransactionBehavior.Never.
  • Failures are logged and swallowed so auditing never breaks the business transaction.

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on KitStack.Audit.Sinks.Mongo:

Package Downloads
KitStack.Audit.AspNetCore

ASP.NET Core wiring for KitStack.Audit: one-call setup, sink selection, narration, and health checks.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.9 140 6/10/2026
0.1.8 122 6/9/2026
0.1.7 130 6/9/2026
0.1.6 119 6/9/2026
0.1.5 129 6/9/2026