MongoDBBuilderExtensions Methods
Class Methods 9 members
Provides extension methods for adding MongoDB resources to an
Hosting.IDistributedApplicationBuilder. AddDatabase(IResourceBuilder<MongoDBServerResource>, string, string?) Section titled AddDatabase(IResourceBuilder<MongoDBServerResource>, string, string?) extension IResourceBuilder<MongoDBDatabaseResource> Adds a MongoDB database to the application model.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoDBDatabaseResource> AddDatabase( this IResourceBuilder<MongoDBServerResource> builder, string name, string? databaseName = null) { // ... }}Parameters
builder IResourceBuilder<MongoDBServerResource> The MongoDB server resource builder. name string The name of the resource. This name will be used as the connection string name when referenced in a dependency. databaseName string? optional The name of the database. If not provided, this defaults to the same value as name. Returns
IResourceBuilder<MongoDBDatabaseResource> A reference to the ApplicationModel.IResourceBuilder`1. AddMongoDB(IDistributedApplicationBuilder, string, int?) Section titled AddMongoDB(IDistributedApplicationBuilder, string, int?) extension IResourceBuilder<MongoDBServerResource> Adds a MongoDB resource to the application model. A container is used for local development.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoDBServerResource> AddMongoDB( this IDistributedApplicationBuilder builder, string name, int? port) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder. name string The name of the resource. This name will be used as the connection string name when referenced in a dependency. port int? The host port for MongoDB. Returns
IResourceBuilder<MongoDBServerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
This version of the package defaults to the tag of the container image.
AddMongoDB(IDistributedApplicationBuilder, string, int?, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>) Section titled AddMongoDB(IDistributedApplicationBuilder, string, int?, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>) extension IResourceBuilder<MongoDBServerResource> public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoDBServerResource> AddMongoDB( this IDistributedApplicationBuilder builder, string name, int? port = null, IResourceBuilder<ParameterResource>? userName = null, IResourceBuilder<ParameterResource>? password = null) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder. name string The name of the resource. This name will be used as the connection string name when referenced in a dependency. port int? optional The host port for MongoDB. userName IResourceBuilder<ParameterResource> optional A parameter that contains the MongoDb server user name, or null to use a default value. password IResourceBuilder<ParameterResource> optional A parameter that contains the MongoDb server password, or null to use a generated password. Returns
IResourceBuilder<MongoDBServerResource> A reference to the ApplicationModel.IResourceBuilder`1. WithDataBindMount(IResourceBuilder<MongoDBServerResource>, string, bool) Section titled WithDataBindMount(IResourceBuilder<MongoDBServerResource>, string, bool) extension IResourceBuilder<MongoDBServerResource> Adds a bind mount for the data folder to a MongoDB container resource.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoDBServerResource> WithDataBindMount( this IResourceBuilder<MongoDBServerResource> builder, string source, bool isReadOnly = false) { // ... }}Parameters
builder IResourceBuilder<MongoDBServerResource> The resource builder. source string The source directory on the host to mount into the container. isReadOnly bool optional A flag that indicates if this is a read-only mount. Returns
IResourceBuilder<MongoDBServerResource> The ApplicationModel.IResourceBuilder`1. WithDataVolume(IResourceBuilder<MongoDBServerResource>, string?, bool) Section titled WithDataVolume(IResourceBuilder<MongoDBServerResource>, string?, bool) extension IResourceBuilder<MongoDBServerResource> Adds a named volume for the data folder to a MongoDB container resource.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoDBServerResource> WithDataVolume( this IResourceBuilder<MongoDBServerResource> builder, string? name = null, bool isReadOnly = false) { // ... }}Parameters
builder IResourceBuilder<MongoDBServerResource> The resource builder. name string? optional The name of the volume. Defaults to an auto-generated name based on the application and resource names. isReadOnly bool optional A flag that indicates if this is a read-only volume. Returns
IResourceBuilder<MongoDBServerResource> The ApplicationModel.IResourceBuilder`1. WithHostPort(IResourceBuilder<MongoExpressContainerResource>, int?) Section titled WithHostPort(IResourceBuilder<MongoExpressContainerResource>, int?) extension IResourceBuilder<MongoExpressContainerResource> Configures the host port that the Mongo Express resource is exposed on instead of using randomly assigned port.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoExpressContainerResource> WithHostPort( this IResourceBuilder<MongoExpressContainerResource> builder, int? port) { // ... }}Parameters
builder IResourceBuilder<MongoExpressContainerResource> The resource builder for Mongo Express. port int? The port to bind on the host. If null is used random port will be assigned. Returns
IResourceBuilder<MongoExpressContainerResource> A reference to the ApplicationModel.IResourceBuilder`1. WithInitBindMount(IResourceBuilder<MongoDBServerResource>, string, bool) Section titled WithInitBindMount(IResourceBuilder<MongoDBServerResource>, string, bool) extension IResourceBuilder<MongoDBServerResource> Adds a bind mount for the init folder to a MongoDB container resource.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoDBServerResource> WithInitBindMount( this IResourceBuilder<MongoDBServerResource> builder, string source, bool isReadOnly = true) { // ... }}Parameters
builder IResourceBuilder<MongoDBServerResource> The resource builder. source string The source directory on the host to mount into the container. isReadOnly bool optional A flag that indicates if this is a read-only mount. Returns
IResourceBuilder<MongoDBServerResource> The ApplicationModel.IResourceBuilder`1. WithInitFiles(IResourceBuilder<MongoDBServerResource>, string) Section titled WithInitFiles(IResourceBuilder<MongoDBServerResource>, string) extension IResourceBuilder<MongoDBServerResource> Copies init files into a MongoDB container resource.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<MongoDBServerResource> WithInitFiles( this IResourceBuilder<MongoDBServerResource> builder, string source) { // ... }}Parameters
builder IResourceBuilder<MongoDBServerResource> The resource builder. source string The source file or directory on the host to copy into the container. Returns
IResourceBuilder<MongoDBServerResource> The ApplicationModel.IResourceBuilder`1. WithMongoExpress(IResourceBuilder<T>, Action<IResourceBuilder<MongoExpressContainerResource>>, string?) Section titled WithMongoExpress(IResourceBuilder<T>, Action<IResourceBuilder<MongoExpressContainerResource>>, string?) extension IResourceBuilder<T> Adds a MongoExpress administration and development platform for MongoDB to the application model.
public static class MongoDBBuilderExtensions{ public static IResourceBuilder<T> WithMongoExpress<T>( this IResourceBuilder<T> builder, Action<IResourceBuilder<MongoExpressContainerResource>>? configureContainer = null, string? containerName = null) { // ... }}Parameters
builder IResourceBuilder<T> The MongoDB server resource builder. configureContainer Action<IResourceBuilder<MongoExpressContainerResource>> optional Configuration callback for Mongo Express container resource. containerName string? optional The name of the container (Optional). Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
This version of the package defaults to the tag of the container image.