Watch Aspire live streamsDocsTry Aspire
Watch Aspire live streamsDocsTry

MongoDBServerResource Properties

ClassProperties11 members
A resource that represents a MongoDB container.
ConnectionStringExpressionSection titled ConnectionStringExpressionReferenceExpression
Gets the connection string for the MongoDB server.
public ReferenceExpression ConnectionStringExpression { get; }
DatabasesSection titled DatabasesIReadOnlyDictionary<string, string>
A dictionary where the key is the resource name and the value is the database name.
public IReadOnlyDictionary<string, string> Databases { get; }
HostSection titled HostEndpointReferenceExpression
Gets the host endpoint reference for this resource.
public EndpointReferenceExpression Host { get; }
PasswordParameterSection titled PasswordParameternullableParameterResource?
Gets the parameter that contains the MongoDb server password.
public ParameterResource? PasswordParameter { get; }
PortSection titled PortEndpointReferenceExpression
Gets the port endpoint reference for this resource.
public EndpointReferenceExpression Port { get; }
PrimaryEndpointSection titled PrimaryEndpointEndpointReference
Gets the primary endpoint for the MongoDB server.
public EndpointReference PrimaryEndpoint { get; }
ReplicaSetNameSection titled ReplicaSetNamenullablestring?
Gets the name of the replica set this MongoDB server belongs to, or null if it is not part of a replica set.
public string? ReplicaSetName { get; }
Gets a value indicating whether TLS is enabled for the MongoDB server.
public bool TlsEnabled { get; }
This property proxies through to EndpointAnnotation.TlsEnabled on the MongoDBServerResource.PrimaryEndpoint, which is turned on when an HTTPS/TLS certificate is determined to be available for the resource. It is resolved lazily so that it stays correct even when TLS is enabled later in the application lifecycle (during BeforeStartEvent).
UriExpressionSection titled UriExpressionReferenceExpression
Gets the connection URI expression for the MongoDB server.
public ReferenceExpression UriExpression { get; }
Format: mongodb://[user:password@]{host}:{port}[?authSource=admin&authMechanism=SCRAM-SHA-256]. The credential and query segments are included only when a password is configured.
UserNameParameterSection titled UserNameParameternullableParameterResource?
Gets the parameter that contains the MongoDb server username.
public ParameterResource? UserNameParameter { get; }
UserNameReferenceSection titled UserNameReferenceReferenceExpression
Gets a reference to the user name for the MongoDB server.
public ReferenceExpression UserNameReference { get; }
Returns the user name parameter if specified, otherwise returns the default user name "admin".