# MongoDBDatabaseResource

- Kind: `class`
- Package: [Aspire.Hosting.MongoDB](/reference/api/csharp/aspire.hosting.mongodb.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs)
- Inherits: `Resource`
- Implements: `IExpressionValue`, `IManifestExpressionProvider`, `IResource`, `IResourceWithConnectionString`, `IResourceWithParent`, `IResourceWithParent<MongoDBServerResource>`, `IValueProvider`, `IValueWithReferences`

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

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public class MongoDBDatabaseResource
    : Aspire.Hosting.ApplicationModel.Resource,
      Aspire.Hosting.ApplicationModel.IExpressionValue,
      Aspire.Hosting.ApplicationModel.IManifestExpressionProvider,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithConnectionString,
      Aspire.Hosting.ApplicationModel.IResourceWithParent,
      Aspire.Hosting.ApplicationModel.IResourceWithParent<Aspire.Hosting.ApplicationModel.MongoDBServerResource>,
      Aspire.Hosting.ApplicationModel.IValueProvider,
      Aspire.Hosting.ApplicationModel.IValueWithReferences
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.MongoDB/MongoDBDatabaseResource`

## Constructors

- [MongoDBDatabaseResource(string, string, MongoDBServerResource)](/reference/api/csharp/aspire.hosting.mongodb/mongodbdatabaseresource/constructors.md#constructor-string-string-mongodbserverresource) -- A resource that represents a MongoDB database. This is a child resource of a [MongoDBServerResource](/reference/api/csharp/aspire.hosting.mongodb/mongodbserverresource.md).

## Properties

- [ConnectionStringExpression](/reference/api/csharp/aspire.hosting.mongodb/mongodbdatabaseresource/properties.md#connectionstringexpression) : `ReferenceExpression` `get` -- Gets the connection string expression for the MongoDB database.
- [DatabaseName](/reference/api/csharp/aspire.hosting.mongodb/mongodbdatabaseresource/properties.md#databasename) : `string` `get` -- Gets the database name.
- [Parent](/reference/api/csharp/aspire.hosting.mongodb/mongodbdatabaseresource/properties.md#parent) : [MongoDBServerResource](/reference/api/csharp/aspire.hosting.mongodb/mongodbserverresource.md) `get` -- Gets the parent MongoDB container resource.
- [UriExpression](/reference/api/csharp/aspire.hosting.mongodb/mongodbdatabaseresource/properties.md#uriexpression) : `ReferenceExpression` `get` -- Gets the connection URI expression for the MongoDB database.
