# 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: `6`

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/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L32)

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/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L77)

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="sharedkeyfileparameter"></a>

## SharedKeyFileParameter

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

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/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L53)

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/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L45)

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/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.MongoDB/ReplicaSet/MongoDBReplicaSetResource.cs#L59-L61)

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

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