Client Connections
The MongoDB connection string was covered in Chapter 3, Servers and Clients. Database services deployed in Atlas are always replica set clusters, and the connection string can be copied from the Atlas interface. In this section, we will explore the connections between clients and MongoDB clusters.
Connecting to a Replica Set
In general, the same rules apply for the MongoDB connection string. Consider the following screenshot, which shows such a connection:
As shown in Figure10.6, the connection string looks like this:
"mongodb+srv://cluster0.<id#>.mongodb.net/<db_name>"
As explained in Chapter 3, Servers and Clients, this type of string needs DNS to resolve the actual server names or IP addresses. In this example, the connection string contains the Atlas cluster name cluster0
and the ID number u7n6b
.
Note
In your case, the connection string...