# MongoDBDatabaseResource Properties

- Package: [Aspire.Hosting.MongoDB](/reference/api/csharp/aspire.hosting.mongodb.md)
- Type: [MongoDBDatabaseResource](/reference/api/csharp/aspire.hosting.mongodb/mongodbdatabaseresource.md)
- Kind: `Properties`
- Members: `4`

A resource that represents a MongoDB database. This is a child resource of a [MongoDBServerResource](/reference/api/csharp/aspire.hosting.mongodb/mongodbserverresource.md).

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs#L25)

Gets the connection string expression for the MongoDB database.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

## DatabaseName

- Name: `DatabaseName`
- Modifiers: `get`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs#L43)

Gets the database name.

```csharp
public string DatabaseName { get; }
```

## Parent

- Name: `Parent`
- Modifiers: `get`
- Returns: [MongoDBServerResource](/reference/api/csharp/aspire.hosting.mongodb/mongodbserverresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs#L38)

Gets the parent MongoDB container resource.

```csharp
public MongoDBServerResource Parent { get; }
```

## UriExpression

- Name: `UriExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs#L33)

Gets the connection URI expression for the MongoDB database.

```csharp
public ReferenceExpression UriExpression { get; }
```

## Remarks

Format: `mongodb://[user:password@]{host}:{port}/{database}[?authSource=admin&authMechanism=SCRAM-SHA-256]`. The credential and query segments are included only when a password is configured.
