# MongoDBDatabaseResource Constructors

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

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

## MongoDBDatabaseResource(string, string, MongoDBServerResource)

- Name: `Constructor(string, string, MongoDBServerResource)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs#L19-L42)

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

```csharp
public class MongoDBDatabaseResource
{
    public MongoDBDatabaseResource(
        string name,
        string databaseName,
        MongoDBServerResource parent)
    {
        // ...
    }
}
```

## Parameters

- `name` (`string`)
  The name of the resource.
- `databaseName` (`string`)
  The database name.
- `parent` ([MongoDBServerResource](/reference/api/csharp/aspire.hosting.mongodb/mongodbserverresource.md))
  The MongoDB server resource associated with this database.
