# Aspire.Hosting.MongoDB

- Module: `Aspire.Hosting.MongoDB`
- Version: `17.0.0`
- Import path: `apphost/modules/aspire`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)
- Functions: `15`
- Types: `5`

## Handles

- [MongoDBDatabaseResource](/reference/api/go/aspire.hosting.mongodb/mongodbdatabaseresource.md) -- `handle` - 5 members -- A resource that represents a MongoDB database. This is a child resource of a `MongoDBServerResource`.
- [MongoDBReplicaSetResource](/reference/api/go/aspire.hosting.mongodb/mongodbreplicasetresource.md) -- `handle` - 8 members -- Represents a MongoDB replica set resource in the application model. A replica set is a group of MongoDB servers that maintain the same data set, providing redundancy and high availability.
- [MongoDBServerResource](/reference/api/go/aspire.hosting.mongodb/mongodbserverresource.md) -- `handle` - 23 members -- A resource that represents a MongoDB container.
- [MongoExpressContainerResource](/reference/api/go/aspire.hosting.mongodb/mongoexpresscontainerresource.md) -- `handle` - 1 members

## Enums

- [MongoDBTlsMode](/reference/api/go/aspire.hosting.mongodb/mongodbtlsmode.md) -- `enum` - 3 values -- Defines the TLS mode for MongoDB server.

## Functions

- [AddMongoDB](/reference/api/go/aspire.hosting.mongodb/addmongodb.md) -- `method` - on `DistributedApplicationBuilder` -- Adds a MongoDB container resource
- [AddMongoDBReplicaSet](/reference/api/go/aspire.hosting.mongodb/addmongodbreplicaset.md) -- `method` - on `DistributedApplicationBuilder` -- Adds a MongoDB replica set resource to the application model.
- [WithMember](/reference/api/go/aspire.hosting.mongodb/withmember.md) -- `method` - on `MongoDBReplicaSetResource` -- Adds a MongoDB server resource as a member of the replica set.
- [AddDatabase](/reference/api/go/aspire.hosting.mongodb/adddatabase.md) -- `method` - on `MongoDBServerResource` -- Adds a MongoDB database to the application model.
- [WithBindIpAll](/reference/api/go/aspire.hosting.mongodb/withbindipall.md) -- `method` - on `MongoDBServerResource` -- Configures the MongoDB server to bind to and listen on all network interfaces.
- [WithDataBindMount](/reference/api/go/aspire.hosting.mongodb/withdatabindmount.md) -- `method` - on `MongoDBServerResource` -- Adds a bind mount for the data folder to a MongoDB container resource.
- [WithDataVolume](/reference/api/go/aspire.hosting.mongodb/withdatavolume.md) -- `method` - on `MongoDBServerResource` -- Adds a named volume for the data folder to a MongoDB container resource.
- [WithInitFiles](/reference/api/go/aspire.hosting.mongodb/withinitfiles.md) -- `method` - on `MongoDBServerResource` -- Copies init files into a MongoDB container resource.
- [WithKeyFile](/reference/api/go/aspire.hosting.mongodb/withkeyfile.md) -- `method` - on `MongoDBServerResource` -- Sets up a keyfile for internal authentication between members of a MongoDB replica set, with the specified `keyValue` as the content of the file.
- [WithMongoExpress](/reference/api/go/aspire.hosting.mongodb/withmongoexpress.md) -- `method` - on `MongoDBServerResource` -- Adds a MongoExpress administration and development platform for MongoDB to the application model.
- [WithRepl](/reference/api/go/aspire.hosting.mongodb/withrepl.md) -- `method` - on `MongoDBServerResource` -- Adds a REPL command that opens an authenticated MongoDB shell in the dashboard terminal dock.
- [WithReplicaSet](/reference/api/go/aspire.hosting.mongodb/withreplicaset.md) -- `method` - on `MongoDBServerResource` -- Configures and initializes the MongoDB server as a single-member replica set for local development.
- [WithTlsAllowInvalidCertificates](/reference/api/go/aspire.hosting.mongodb/withtlsallowinvalidcertificates.md) -- `method` - on `MongoDBServerResource` -- Configures the MongoDB server to accept TLS connections whose peer certificate cannot be validated, by passing `--tlsAllowInvalidCertificates` to `mongod`.
- [WithTlsMode](/reference/api/go/aspire.hosting.mongodb/withtlsmode.md) -- `method` - on `MongoDBServerResource` -- Configures the `--tlsMode` the MongoDB server is started with when TLS is active.
- [WithHostPort](/reference/api/go/aspire.hosting.mongodb/withhostport.md) -- `method` - on `MongoExpressContainerResource` -- Configures the host port that the Mongo Express resource is exposed on instead of using randomly assigned port.
