Skip to content
DocsTry Aspire
DocsTry

DocumentDBServerResource Properties

ClassProperties7 members
A resource that represents a DocumentDB container.
ConnectionStringExpressionSection titled ConnectionStringExpressionReferenceExpression
Gets the connection string for the DocumentDB server.
public ReferenceExpression ConnectionStringExpression { get; }
The user name and password are percent-encoded into the URI userinfo component. Aspire applies RFC 3986 escaping ( Uri.EscapeDataString) when it resolves this reference, so MongoDB clients decode the original values back. In a published manifest the escaping is instead performed by the downstream publisher, which does not necessarily match RFC 3986; see Credential encoding for publisher-specific behavior, including the azd limitation for credentials containing spaces.
The databases created under this server.
public IReadOnlyList<DocumentDBDatabaseResource> Databases { get; }
PasswordParameterSection titled PasswordParameternullableParameterResource?
Gets the parameter that contains the DocumentDB server password.
public ParameterResource? PasswordParameter { get; }
PostgresConnectionStringExpressionSection titled PostgresConnectionStringExpressionReferenceExpression
Gets the PostgreSQL connection string for the DocumentDB server in the standard postgresql://user:password@host:port/postgres URI form.
public ReferenceExpression PostgresConnectionStringExpression { get; }

The PostgreSQL backend port ( 9712) must be exposed via DocumentDBBuilderExtensions.WithPostgresEndpoint before this property is accessed; otherwise an InvalidOperationException is thrown.

The default database in the URI is postgres, matching the upstream documentdb-local entrypoint, which connects with -d postgres. Credentials come from the same DocumentDBServerResource.UserNameParameter / DocumentDBServerResource.PasswordParameter used by the MongoDB gateway because the container creates a single admin user shared by both surfaces, and they are percent-encoded exactly as they are in DocumentDBServerResource.ConnectionStringExpression, with the same publisher-specific behavior when the model is published.

No sslmode query parameter is added, because the bundled PostgreSQL server is started with ssl = off; the DocumentDBServerResource.TLS field of this resource only controls the MongoDB gateway. Consumers needing TLS on the PostgreSQL side should append ?sslmode=... themselves.

PostgresEndpointSection titled PostgresEndpointEndpointReference
Gets the PostgreSQL backend endpoint for the DocumentDB server.
public EndpointReference PostgresEndpoint { get; }
This endpoint is only allocated when DocumentDBBuilderExtensions.WithPostgresEndpoint has been called on the resource builder. Accessing DocumentDBServerResource.PostgresConnectionStringExpression without first opting in throws an InvalidOperationException.
PrimaryEndpointSection titled PrimaryEndpointEndpointReference
Gets the primary endpoint for the DocumentDB server.
public EndpointReference PrimaryEndpoint { get; }
UserNameParameterSection titled UserNameParameternullableParameterResource?
Gets the parameter that contains the DocumentDB server username.
public ParameterResource? UserNameParameter { get; }