# MongoDBReplicaSetResource

- Module: [Aspire.Hosting.MongoDB](/reference/api/go/aspire.hosting.mongodb.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

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.

## Remarks

This resource is a logical grouping of multiple `MongoDBServerResource` instances that are configured as members of the same replica set.

## Definition

```go
type MongoDBReplicaSetResource interface {
    ExpressionValue
    Resource
    ResourceWithConnectionString
    ResourceWithWaitSupport
}
```

## Embeds

- `ExpressionValue`
- `Resource`
- `ResourceWithConnectionString`
- `ResourceWithWaitSupport`

## Properties

- `ConnectionStringExpression`: `*ReferenceExpression` `get` -- Gets the combined connection string for the MongoDB replica set, which includes the endpoints of all members, interpretable by the MongoDB driver.
- `Members`: [`[]MongoDBServerResource`](/reference/api/go/aspire.hosting.mongodb/mongodbserverresource.md) `get` -- Gets the MongoDB server resources that are members of this replica set, in the order they were added.
- `ResourceTypeDisplayName`: `string` `get` -- Gets the ResourceTypeDisplayName property
- `SharedKeyFileParameter`: `ParameterResource` `get` -- Gets the parameter that contains the content of the key file used for internal authentication between members of the MongoDB replica set.
- `SharedPasswordParameter`: `ParameterResource` `get` -- Gets the parameter that contains the password for authenticating to the MongoDB replica set.
- `SharedUserNameParameter`: `ParameterResource` `get` -- Gets the parameter that contains the username for authenticating to the MongoDB replica set.
- `SharedUserNameReference`: `*ReferenceExpression` `get` -- Gets a reference to the username for the MongoDB replica set.

## Methods

- [WithMember](/reference/api/go/aspire.hosting.mongodb/mongodbreplicasetresource/withmember.md) -- `method` -- Adds a MongoDB server resource as a member of the replica set.
  ```go
  WithMember(member MongoDBServerResource) MongoDBReplicaSetResource
  ```
