Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

AddMongoDB

Method
📦 Aspire.Hosting.MongoDB v17.0.0
func (DistributedApplicationBuilder) AddMongoDB(
name string,
options ...*AddMongoDBOptions,
) MongoDBServerResource

Signature

methodAddMongoDBbuilder
Adds a MongoDB container resource
AddMongoDB(
name string,
options ...*AddMongoDBOptions,
) MongoDBServerResource
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
options...*AddMongoDBOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*AddMongoDBOptions argument.

Port*float64The host port for MongoDB.
UserName*ParameterResourceA parameter that contains the MongoDb server user name, or null to use a default value.
Password*ParameterResourceA parameter that contains the MongoDb server password, or null to use a generated password.
MongoDBServerResource

The resource builder.

Returns a handle; failures surface later via Err().

Applies to

This method applies to the following types:

typeDistributedApplicationBuilder