# MongoDBServerResource

- Module: [Aspire.Hosting.MongoDB](/reference/api/typescript/aspire.hosting.mongodb.md)
- Version: `13.2.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

## Definition

```typescript
interface MongoDBServerResource
  extends IComputeResource,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly databases: Dict<string,string>;
  entrypoint: string;
  readonly host: EndpointReferenceExpression;
  readonly name: string;
  readonly passwordParameter: ParameterResource;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  shellExecution: boolean;
  readonly uriExpression: ReferenceExpression;
  readonly userNameParameter: ParameterResource;
  readonly userNameReference: ReferenceExpression;
  addDatabase(
      name: string,
      databaseName?: string): MongoDBDatabaseResource;
  withDataBindMount(
      source: string,
      isReadOnly?: boolean): MongoDBServerResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): MongoDBServerResource;
  withInitFiles(source: string): MongoDBServerResource;
  withMongoExpress(configureContainer?: (obj: MongoExpressContainerResource) => Promise<void>, containerName?: string): MongoDBServerResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the ConnectionStringExpression property
- `databases`: `Dict<string,string>` `get` -- Gets the Databases property
- `entrypoint`: `string` `get - set` -- Gets the Entrypoint property
- `host`: `EndpointReferenceExpression` `get` -- Gets the Host property
- `name`: `string` `get` -- Gets the Name property
- `passwordParameter`: `ParameterResource` `get` -- Gets the PasswordParameter property
- `port`: `EndpointReferenceExpression` `get` -- Gets the Port property
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the PrimaryEndpoint property
- `shellExecution`: `boolean` `get - set` -- Gets the ShellExecution property
- `uriExpression`: `ReferenceExpression` `get` -- Gets the UriExpression property
- `userNameParameter`: `ParameterResource` `get` -- Gets the UserNameParameter property
- `userNameReference`: `ReferenceExpression` `get` -- Gets the UserNameReference property

## Methods

- [addDatabase](/reference/api/typescript/aspire.hosting.mongodb/mongodbserverresource/adddatabase.md) -- `method` -- Adds a MongoDB database resource
    ```typescript
  addDatabase(name: string, databaseName?: string): MongoDBDatabaseResource
  ```
- [withDataBindMount](/reference/api/typescript/aspire.hosting.mongodb/mongodbserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the MongoDB data folder
    ```typescript
  withDataBindMount(source: string, isReadOnly?: boolean): MongoDBServerResource
  ```
- [withDataVolume](/reference/api/typescript/aspire.hosting.mongodb/mongodbserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the MongoDB data folder
    ```typescript
  withDataVolume(name?: string, isReadOnly?: boolean): MongoDBServerResource
  ```
- [withInitFiles](/reference/api/typescript/aspire.hosting.mongodb/mongodbserverresource/withinitfiles.md) -- `method` -- Copies init files into a MongoDB container
    ```typescript
  withInitFiles(source: string): MongoDBServerResource
  ```
- [withMongoExpress](/reference/api/typescript/aspire.hosting.mongodb/mongodbserverresource/withmongoexpress.md) -- `method` -- Adds a MongoExpress administration platform for MongoDB
    ```typescript
  withMongoExpress(configureContainer?: (obj: MongoExpressContainerResource) => Promise<void>, containerName?: string): MongoDBServerResource
  ```
