Use community extensions for MongoDB hosting
Ce contenu n’est pas encore disponible dans votre langue.
The Aspire Community Toolkit MongoDB hosting extensions package provides extra functionality to the Aspire.Hosting.MongoDB hosting package.
This package provides the following features:
- DbGate management UI
Hosting integration
Section titled “Hosting integration”To get started with the Aspire Community Toolkit MongoDB hosting extensions, install the CommunityToolkit.Aspire.Hosting.MongoDB.Extensions NuGet package in the AppHost project.
aspire add communitytoolkit-mongodb-extensionsLa CLI Aspire est interactive ; choisissez le résultat approprié lorsque demandé :
Select an integration to add:
> communitytoolkit-mongodb-extensions (CommunityToolkit.Aspire.Hosting.MongoDB.Extensions)> Other results listed as selectable options...#:package CommunityToolkit.Aspire.Hosting.MongoDB.Extensions@*<PackageReference Include="CommunityToolkit.Aspire.Hosting.MongoDB.Extensions" Version="*" />For TypeScript AppHosts, add the Community Toolkit MongoDB extensions package to aspire.config.json:
{ "packages": { "CommunityToolkit.Aspire.Hosting.MongoDB.Extensions": "*" }}Add management UI
Section titled “Add management UI”DbGate management UI
Section titled “DbGate management UI”To add the DbGate management UI to your MongoDB resource, call the WithDbGate method on the MongoDBResourceBuilder instance:
var builder = DistributedApplication.CreateBuilder(args);
var mongodb = builder.AddMongoDB("mongodb") .WithDbGate();
builder.AddProject<Projects.ExampleProject>("api") .WithReference(mongodb);
builder.Build().Run();import { createBuilder } from "./.aspire/modules/aspire.mjs";
const builder = await createBuilder();
const mongodb = await builder.addMongoDB("mongodb");await mongodb.withDbGate();
const api = await builder.addProject("api", "../Api/Api.csproj");await api.withReference(mongodb);
await builder.build().run();This adds a new DbGate resource to the AppHost which is available from the Aspire dashboard. DbGate is a comprehensive database management tool that provides a web-based interface for managing your MongoDB databases.