# SurrealDbServerResource

- Module: [CommunityToolkit.Aspire.Hosting.SurrealDb](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb.md)
- Version: `13.4.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire)

A resource that represents a SurrealDB container.

## Definition

```typescript
interface SurrealDbServerResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly host: EndpointReferenceExpression;
  readonly namespaces: Dict<string,string>;
  readonly passwordParameter: ParameterResource;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  readonly uriExpression: ReferenceExpression;
  readonly userNameParameter: ParameterResource;
  addNamespace(
      name: string,
      namespaceName?: string): SurrealDbNamespaceResource;
  withDataBindMount(source: string): SurrealDbServerResource;
  withDataVolume(name?: string): SurrealDbServerResource;
  withInitFiles(source: string): SurrealDbServerResource;
  withLogLevel(logLevel: string): SurrealDbServerResource;
  withSurrealDbOtlpExporter(): SurrealDbServerResource;
  withSurrealist(containerName?: string): SurrealDbServerResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the SurrealDB instance.
- `host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- `namespaces`: `Dict<string,string>` `get` -- A dictionary where the key is the resource name and the value is the namespace name.
- `passwordParameter`: `ParameterResource` `get` -- Gets the parameter that contains the SurrealDB password.
- `port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the SurrealDB instance.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the SurrealDB instance.
- `userNameParameter`: `ParameterResource` `get` -- Gets the parameter that contains the SurrealDB username.

## Methods

- [addNamespace](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource/addnamespace.md) -- `method` -- Adds a SurrealDB namespace resource to the application model
    ```typescript
  addNamespace(name: string, namespaceName?: string): SurrealDbNamespaceResource
  ```
- [withDataBindMount](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a SurrealDB resource.
    ```typescript
  withDataBindMount(source: string): SurrealDbServerResource
  ```
- [withDataVolume](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a SurrealDB resource.
    ```typescript
  withDataVolume(name?: string): SurrealDbServerResource
  ```
- [withInitFiles](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource/withinitfiles.md) -- `method` -- Copies init files into a SurrealDB container resource.
    ```typescript
  withInitFiles(source: string): SurrealDbServerResource
  ```
- [withLogLevel](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource/withloglevel.md) -- `method`
    ```typescript
  withLogLevel(logLevel: string): SurrealDbServerResource
  ```
- [withSurrealDbOtlpExporter](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource/withsurrealdbotlpexporter.md) -- `method` -- Injects the appropriate environment variables to allow the resource to enable sending telemetry to the dashboard. 1. It sets the OTLP endpoint to the value of the DOTNET_DASHBOARD_OTLP_ENDPOINT_URL environment variable. 2. It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator. 3. It sets a small batch schedule delay in development. This reduces the delay that OTLP exporter waits to sends telemetry and makes the dashboard telemetry pages responsive.
    ```typescript
  withSurrealDbOtlpExporter(): SurrealDbServerResource
  ```
- [withSurrealist](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource/withsurrealist.md) -- `method`
    ```typescript
  withSurrealist(containerName?: string): SurrealDbServerResource
  ```
