# MongoDBReplicaSetResource Properties

- Package: [Aspire.Hosting.MongoDB](/reference/api/csharp/aspire.hosting.mongodb.md)
- Type: [MongoDBReplicaSetResource](/reference/api/csharp/aspire.hosting.mongodb/mongodbreplicasetresource.md)
- Kind: `Properties`
- Members: `7`

Represents a MongoDB replica set resource in the application model. A replica set is a group of MongoDB servers that maintain the same data set, providing redundancy and high availability.

<a id="connectionstringexpression"></a>

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L35)

Gets the combined connection string for the MongoDB replica set, which includes the endpoints of all members, interpretable by the MongoDB driver.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

<a id="members"></a>

## Members

- Name: `Members`
- Modifiers: `get`
- Returns: [IEnumerable<MongoDBServerResource>](/reference/api/csharp/aspire.hosting.mongodb/mongodbserverresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L80)

Gets the MongoDB server resources that are members of this replica set, in the order they were added.

```csharp
public IEnumerable<MongoDBServerResource> Members { get; }
```

<a id="resourcetypedisplayname"></a>

## ResourceTypeDisplayName

- Name: `ResourceTypeDisplayName`
- Modifiers: `override` `get`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L30)

Gets the default human-readable name of this resource's type.

```csharp
public override string ResourceTypeDisplayName { get; }
```

## Remarks

Override this property to identify the service, such as Redis or PostgreSQL Server, independently of its technical resource type. The default is the resource type. This label does not change the resource name, service discovery, or OpenTelemetry identity. Use `ResourceBuilderExtensions.WithResourceTypeDisplayName` to override the label for an instance.

<a id="sharedkeyfileparameter"></a>

## SharedKeyFileParameter

- Name: `SharedKeyFileParameter`
- Modifiers: `get`
- Returns: `ParameterResource`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L40)

Gets the parameter that contains the content of the key file used for internal authentication between members of the MongoDB replica set.

```csharp
public ParameterResource SharedKeyFileParameter { get; }
```

<a id="sharedpasswordparameter"></a>

## SharedPasswordParameter

- Name: `SharedPasswordParameter`
- Modifiers: `get`
- Returns: `ParameterResource`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L56)

Gets the parameter that contains the password for authenticating to the MongoDB replica set.

```csharp
public ParameterResource SharedPasswordParameter { get; }
```

## Remarks

This will be the same across all members of the replica set, and is used in conjunction with [MongoDBReplicaSetResource.SharedUserNameParameter](/reference/api/csharp/aspire.hosting.mongodb/mongodbreplicasetresource/properties.md#sharedusernameparameter) for authentication.

<a id="sharedusernameparameter"></a>

## SharedUserNameParameter

- Name: `SharedUserNameParameter`
- Modifiers: `nullable` `get`
- Returns: `ParameterResource?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L48)

Gets the parameter that contains the username for authenticating to the MongoDB replica set.

```csharp
public ParameterResource? SharedUserNameParameter { get; }
```

## Remarks

This will be the same across all members of the replica set, and is used in conjunction with [MongoDBReplicaSetResource.SharedPasswordParameter](/reference/api/csharp/aspire.hosting.mongodb/mongodbreplicasetresource/properties.md#sharedpasswordparameter) for authentication.

<a id="sharedusernamereference"></a>

## SharedUserNameReference

- Name: `SharedUserNameReference`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L62-L64)

Gets a reference to the username for the MongoDB replica set.

```csharp
public ReferenceExpression SharedUserNameReference { get; }
```
