How to create Custom Replica Set in Mongodb Atlas

So I am able create custom Replica set on my localhost using configuration files.
By custom I mean I can set priority of node and also setup some delay in secondary.
I am also able to connect to only individual nodes of replica in my Express app using different ports in Connection String.

I wanted to ask how to do these same things when using Mongodb Atlas. I am not able to find any docs or anything about it. When I open my project in Mongodb Atlas Dashboard, I noticed it mentioned it is using 3 regions and that it is a Replica set but I am unable to connect with the individually using same Express code that I used when connecting with individual nodes of Replica set running on localhost.
I am only able to connect to whole Mongodb Atlas cluster in Express.

So it will be really helpful if someone could guide or share these details about Mongodb Atlas.

Hi @Naman_Saxena1,
Can you try as suggested from documentation:



You can see the priority of each node by going to the Metrics tab of a cluster and hovering over the node state icon. For example:

In addition to Fabio’s comments, you won’t be able to set a specific numeric value for the priority of the Atlas cluster node’s. More information on unsupported commands in Atlas. The closest thing would be a multi region cluster in which you can change the order of the priority (highest to lowest) by region (example on linked page). However, this may not suit your use case.

Can you explain the reasoning for the delay in the secondary you’ve mentioned?


1 Like

Thanks @Fabio_Ramohitaj and @Jason_Tran for information.

So use case is I am studying system design and practicing MongoDb.
There is a topic of setting some delay in secondary replica, it helps to create a time window during which we can recover data from a point in time before a destructive event occurred. This is valuable in scenarios where we want to recover from accidental data corruption or a malicious attack.

I was able to setup delay when running on localhost using below commands, so just got curious if it is also possible in Mongodb Atlas.

cfg = rs.conf()
cfg.members[0].priority = 0
cfg.members[0].hidden = true
cfg.members[0].secondaryDelaySecs = 3600
1 Like

Thanks for the details Naman. Unfortunately rs.reconfig() is one of the unsupported commands in Atlas (noted in the Replication section) so you won’t be able to execute the same on your Atlas cluster.

1 Like

@Jason_Tran got it, thanks!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.