MongoDBBuilderExtensions.AddMongoDB Method

Definition

Overloads

AddMongoDB(IDistributedApplicationBuilder, String, Nullable<Int32>)

Adds a MongoDB resource to the application model. A container is used for local development.

AddMongoDB(IDistributedApplicationBuilder, String, Nullable<Int32>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>)

Adds a MongoDB resource to the application model. A container is used for local development.

AddMongoDB(IDistributedApplicationBuilder, String, Nullable<Int32>)

Source:
MongoDBBuilderExtensions.cs
Source:
MongoDBBuilderExtensions.cs

Adds a MongoDB resource to the application model. A container is used for local development.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MongoDBServerResource> AddMongoDB (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, int? port = default);
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MongoDBServerResource> AddMongoDB (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, int? port);
static member AddMongoDB : Aspire.Hosting.IDistributedApplicationBuilder * string * Nullable<int> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MongoDBServerResource>
<Extension()>
Public Function AddMongoDB (builder As IDistributedApplicationBuilder, name As String, Optional port As Nullable(Of Integer) = Nothing) As IResourceBuilder(Of MongoDBServerResource)
<Extension()>
Public Function AddMongoDB (builder As IDistributedApplicationBuilder, name As String, port As Nullable(Of Integer)) As IResourceBuilder(Of MongoDBServerResource)

Parameters

name
String

The name of the resource. This name will be used as the connection string name when referenced in a dependency.

port
Nullable<Int32>

The host port for MongoDB.

Returns

A reference to the IResourceBuilder<T>.

Remarks

This version of the package defaults to the tag of the container image.

Applies to

AddMongoDB(IDistributedApplicationBuilder, String, Nullable<Int32>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>)

Source:
MongoDBBuilderExtensions.cs

Adds a MongoDB resource to the application model. A container is used for local development.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MongoDBServerResource> AddMongoDB (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, int? port = default, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? userName = default, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? password = default);
static member AddMongoDB : Aspire.Hosting.IDistributedApplicationBuilder * string * Nullable<int> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MongoDBServerResource>
<Extension()>
Public Function AddMongoDB (builder As IDistributedApplicationBuilder, name As String, Optional port As Nullable(Of Integer) = Nothing, Optional userName As IResourceBuilder(Of ParameterResource) = Nothing, Optional password As IResourceBuilder(Of ParameterResource) = Nothing) As IResourceBuilder(Of MongoDBServerResource)

Parameters

name
String

The name of the resource. This name will be used as the connection string name when referenced in a dependency.

port
Nullable<Int32>

The host port for MongoDB.

userName
IResourceBuilder<ParameterResource>

A parameter that contains the MongoDb server user name, or null to use a default value.

password
IResourceBuilder<ParameterResource>

A parameter that contains the MongoDb server password, or null to use a generated password.

Returns

A reference to the IResourceBuilder<T>.

Applies to