Tharga.Team.MongoDB
3.10.0
See the version list below for details.
dotnet add package Tharga.Team.MongoDB --version 3.10.0
NuGet\Install-Package Tharga.Team.MongoDB -Version 3.10.0
<PackageReference Include="Tharga.Team.MongoDB" Version="3.10.0" />
<PackageVersion Include="Tharga.Team.MongoDB" Version="3.10.0" />
<PackageReference Include="Tharga.Team.MongoDB" />
paket add Tharga.Team.MongoDB --version 3.10.0
#r "nuget: Tharga.Team.MongoDB, 3.10.0"
#:package Tharga.Team.MongoDB@3.10.0
#addin nuget:?package=Tharga.Team.MongoDB&version=3.10.0
#tool nuget:?package=Tharga.Team.MongoDB&version=3.10.0
Tharga Team MongoDB
MongoDB persistence layer for Tharga.Team. Provides repository base classes for storing teams and users in MongoDB.
What's included
TeamRepository/ITeamRepository- MongoDB-backed team storage.UserRepository/IUserRepository- MongoDB-backed user storage.TeamRepositoryCollection/UserRepositoryCollection- MongoDB collection definitions with indexes.TeamMemberBase- Base record for team member entities.TeamEntityBase- Base record for team entities.UserServiceRepositoryBase- User service base class with MongoDB persistence.
Quick start
builder.Services.AddThargaTeamRepository(o =>
{
o.RegisterUserRepository<UserEntity>();
o.RegisterTeamRepository<TeamEntity, TeamMember>();
});
Requires Tharga.MongoDB to be configured with a connection string.
Adding per-deployment User indices
The built-in UserRepositoryCollection<TUserEntity> declares a unique index on Identity. To add additional indices (e.g. on a custom email column), subclass the collection and register the subclass via the RegisterUserRepository<TUserEntity, TCollection> overload:
public class MyUserRepositoryCollection : UserRepositoryCollection<MyUserEntity>
{
public MyUserRepositoryCollection(IMongoDbServiceFactory factory, ILogger<UserRepositoryCollection<MyUserEntity>> logger, IOptions<ThargaTeamOptions> options = null)
: base(factory, logger, options) { }
public override IEnumerable<CreateIndexModel<MyUserEntity>> Indices =>
[
// Keep the base Identity index
..base.Indices,
// Plus your own
new(Builders<MyUserEntity>.IndexKeys.Ascending(x => x.EMail),
new CreateIndexOptions { Unique = true, Name = "EMail" })
];
}
builder.Services.AddThargaTeamRepository(o =>
{
o.RegisterUserRepository<MyUserEntity, MyUserRepositoryCollection>();
});
How enums are stored
Every enum this package persists is stored by name, not by ordinal — "Viewer" rather than 3. The
name is the meaning; the ordinal is an accident of declaration order, and a stored ordinal silently comes
to mean something else the moment a member is inserted or reordered.
If you add your own entity, declare it:
[BsonRepresentation(BsonType.String)]
public MyEnum Kind { get; init; }
The driver's default is Int32, so omitting the attribute selects the ordinal without looking like a
choice. A test in this package sweeps every persisted entity and fails if one is missing it.
Changed
TeamEntityBase.ConsentAccessLevel and ApiKeyEntity.AccessLevel previously stored ordinals and now store
names. No migration is required — the driver reads both, so existing documents keep working and convert
the next time each is written.
One thing to check: if you query these two fields directly against the collection — a script, a dashboard,
a report — a numeric comparison such as { ConsentAccessLevel: 3 } will match only the documents not yet
rewritten. Match on the name instead, or on both while the conversion settles. Nothing inside the toolkit
queries them, so this affects external tooling only.
Dependencies
- Tharga.Team - Domain models and service abstractions.
- Tharga.MongoDB - MongoDB repository infrastructure.
Related packages
| Package | Description |
|---|---|
| Tharga.Team | Domain models and authorization primitives |
| Tharga.Team.Blazor | Team management Blazor UI components, authentication |
| Tharga.Team.Service | Server-side API key auth, Swagger, audit logging |
| Tharga.Blazor | Generic Blazor UI components |
| Product | Versions 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. |
-
net10.0
- Tharga.MongoDB (>= 2.14.2)
- Tharga.Team (>= 3.10.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 |
|---|---|---|
| 3.10.4 | 0 | 8/3/2026 |
| 3.10.3 | 36 | 8/2/2026 |
| 3.10.2 | 40 | 8/2/2026 |
| 3.10.1 | 39 | 8/2/2026 |
| 3.10.0 | 42 | 8/1/2026 |
| 3.9.0 | 40 | 8/1/2026 |
| 3.8.3 | 46 | 8/1/2026 |
| 3.8.2 | 39 | 8/1/2026 |
| 3.8.1 | 46 | 7/31/2026 |
| 3.8.0 | 40 | 7/31/2026 |
| 3.7.0 | 65 | 7/30/2026 |
| 3.6.1 | 49 | 7/27/2026 |
| 3.6.0 | 58 | 7/27/2026 |
| 3.5.4 | 59 | 7/27/2026 |
| 3.5.3 | 74 | 7/27/2026 |
| 3.5.2 | 105 | 7/26/2026 |
| 3.5.1 | 94 | 7/24/2026 |
| 3.5.0 | 96 | 7/24/2026 |
| 3.2.1 | 125 | 7/21/2026 |
| 3.2.0 | 97 | 7/20/2026 |