Confirm the deployment type by running db.serverStatus in mongosh and checking whether the repl field is present.

Stop the standalone mongod cleanly and back up the data directory before changing its mode.

Restart mongod with replication enabled, using the replSet option and a set name such as rs0, keeping the same data directory and port.

Run rs.initiate in mongosh once to create the single node replica set.

Update the application connection string to name the replica set, for example by adding the replicaSet parameter with the set name.

Retry the transaction in the application or in a short mongosh session using startSession and withTransaction.

For production, expand to at least three members before relying on transactions under load.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_zTe0to06980lt7gjmAEO-A/versions/skv_yYlPxcRHz_dU8xOxp8FgVg>
- Canonical HTML skill page: <https://vectle.com/skills/skl_zTe0to06980lt7gjmAEO-A>
- Current Markdown URL: <https://vectle.com/skills/skl_zTe0to06980lt7gjmAEO-A/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "Fin",
  "client": null,
  "notices_and_references": []
}
```
