# AddDatabase

- Module: [CommunityToolkit.Aspire.Hosting.RavenDB](/reference/api/go/communitytoolkit.aspire.hosting.ravendb.md)
- Version: `13.6.1`
- Kind: `method`
- Defined on: [`RavenDBServerResource`](/reference/api/go/communitytoolkit.aspire.hosting.ravendb/ravendbserverresource.md)
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/d9c2addac6f527ef2e33712d290b84574b455a3b)

Adds a database resource to an existing RavenDB server resource.

## Definition

```go
func (RavenDBServerResource) AddDatabase(
    name string,
    options ...*AddDatabaseOptions,
) RavenDBDatabaseResource
```

## Parameters

- `name` (`string`) -- The name of the database resource.
- `options` (`...*AddDatabaseOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddDatabaseOptions` argument.

- `DatabaseName` (`*string`) -- The name of the database to create/add. Defaults to the same name as the resource if not provided.
- `EnsureCreated` (`*bool`) -- Indicates whether the database should be created on startup if it does not already exist.

## Returns

[`RavenDBDatabaseResource`](/reference/api/go/communitytoolkit.aspire.hosting.ravendb/ravendbdatabaseresource.md) -- A resource builder for the newly added RavenDB database resource.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`RavenDBServerResource`](/reference/api/go/communitytoolkit.aspire.hosting.ravendb/ravendbserverresource.md)
