Watch Aspire live streamsDocsTry Aspire

MongoDBServerResource

Handle
📦 Aspire.Hosting.MongoDB v13.6.0
interface MongoDBServerResource
extends IComputeResource,
IExpressionValue,
IManifestExpressionProvider,
IResource,
IResourceWithArgs,
IResourceWithConnectionString,
IResourceWithEndpoints,
IResourceWithEnvironment,
IResourceWithProbes,
IResourceWithWaitSupport,
IValueProvider,
IValueWithReferences {
readonly connectionStringExpression: ReferenceExpression;
readonly databases: Dict<string,string>;
readonly host: EndpointReferenceExpression;
passwordParameter: ParameterResource;
readonly port: EndpointReferenceExpression;
readonly primaryEndpoint: EndpointReference;
replicaSetName: string;
readonly tlsEnabled: boolean;
readonly uriExpression: ReferenceExpression;
userNameParameter: ParameterResource;
readonly userNameReference: ReferenceExpression;
addDatabase(
name: string,
databaseName?: string): MongoDBDatabaseResource;
withBindIpAll(): MongoDBServerResource;
withDataBindMount(
source: string,
isReadOnly?: boolean): MongoDBServerResource;
withDataVolume(
name?: string,
isReadOnly?: boolean): MongoDBServerResource;
withInitFiles(source: string): MongoDBServerResource;
withKeyFile(
keyValue: IExpressionValue,
keyFilePath?: string): MongoDBServerResource;
withMongoExpress(configureContainer?: (obj: MongoExpressContainerResource) => Promise<void>, containerName?: string): MongoDBServerResource;
withRepl(): MongoDBServerResource;
withReplicaSet(name?: string): MongoDBServerResource;
withTlsAllowInvalidCertificates(): MongoDBServerResource;
withTlsMode(mode?: MongoDBTlsMode): MongoDBServerResource;
}

Properties

propertyconnectionStringExpressionReferenceExpressionget
Gets the connection string for the MongoDB server.
propertydatabasesDict<string,string>get
A dictionary where the key is the resource name and the value is the database name.
propertyhostEndpointReferenceExpressionget
Gets the host endpoint reference for this resource.
propertypasswordParameterParameterResourceget · set
Gets the parameter that contains the MongoDb server password.
propertyportEndpointReferenceExpressionget
Gets the port endpoint reference for this resource.
propertyprimaryEndpointEndpointReferenceget
Gets the primary endpoint for the MongoDB server.
propertyreplicaSetNamestringget · set
Gets the name of the replica set this MongoDB server belongs to, or `null` if it is not part of a replica set.
propertytlsEnabledbooleanget
Gets a value indicating whether TLS is enabled for the MongoDB server.
propertyuriExpressionReferenceExpressionget
Gets the connection URI expression for the MongoDB server.
propertyuserNameParameterParameterResourceget · set
Gets the parameter that contains the MongoDb server username.
propertyuserNameReferenceReferenceExpressionget
Gets a reference to the user name for the MongoDB server.

Methods

methodaddDatabasebuilder
Adds a MongoDB database to the application model.
addDatabase(
name: string,
databaseName?: string): MongoDBDatabaseResource
namestring
databaseNamestringoptional
MongoDBDatabaseResource
methodwithBindIpAllbuilder
Configures the MongoDB server to bind to and listen on all network interfaces.
withBindIpAll(): MongoDBServerResource
MongoDBServerResource
methodwithDataBindMountbuilder
Adds a bind mount for the data folder to a MongoDB container resource.
withDataBindMount(
source: string,
isReadOnly?: boolean): MongoDBServerResource
sourcestring
isReadOnlybooleanoptional= False
MongoDBServerResource
methodwithDataVolumebuilder
Adds a named volume for the data folder to a MongoDB container resource.
withDataVolume(
name?: string,
isReadOnly?: boolean): MongoDBServerResource
namestringoptional
isReadOnlybooleanoptional= False
MongoDBServerResource
methodwithInitFilesbuilder
Copies init files into a MongoDB container resource.
withInitFiles(source: string): MongoDBServerResource
sourcestring
MongoDBServerResource
methodwithKeyFilebuilder
Sets up a keyfile for internal authentication between members of a MongoDB replica set, with the specified `keyValue` as the content of the file.
withKeyFile(
keyValue: IExpressionValue,
keyFilePath?: string): MongoDBServerResource
keyValueIExpressionValue
keyFilePathstringoptional= /etc/rs.key
MongoDBServerResource
methodwithMongoExpressbuilder
Adds a MongoExpress administration and development platform for MongoDB to the application model.
withMongoExpress(configureContainer?: (obj: MongoExpressContainerResource) => Promise<void>, containerName?: string): MongoDBServerResource
configureContainer(obj: MongoExpressContainerResource) => Promise<void>optional
containerNamestringoptional
MongoDBServerResource
methodwithReplbuilder
Adds a REPL command that opens an authenticated MongoDB shell in the dashboard terminal dock.
withRepl(): MongoDBServerResource
MongoDBServerResource
methodwithReplicaSetbuilder
Configures and initializes the MongoDB server as a single-member replica set for local development.
withReplicaSet(name?: string): MongoDBServerResource
namestringoptional
MongoDBServerResource
Configures the MongoDB server to accept TLS connections whose peer certificate cannot be validated, by passing `--tlsAllowInvalidCertificates` to `mongod`.
withTlsAllowInvalidCertificates(): MongoDBServerResource
MongoDBServerResource
methodwithTlsModebuilder
Configures the `--tlsMode` the MongoDB server is started with when TLS is active.
withTlsMode(mode?: MongoDBTlsMode): MongoDBServerResource
modeMongoDBTlsModeoptional= RequireTls
MongoDBServerResource