--- title: "Connection Configuration for MongoDB" slug: "connection-configuration-mongodb" updated: 2024-08-15T09:34:21Z published: 2024-08-15T09:34:21Z canonical: "documents.trocco.io/connection-configuration-mongodb" --- > ## Documentation Index > Fetch the complete documentation index at: https://documents.trocco.io/llms.txt > Use this file to discover all available pages before exploring further. # Connection Configuration for MongoDB ## summary This is the help page for setting up Connection Configuration for MongoDB. ## entry | item name | indispensable | Contents | | --- | --- | --- | | Name | Yes | Enter the name of the Connection Configuration to be used inside TROCCO. | | memo | No | Enter a note of Connection Configuration to be used inside TROCCO. | | Connection type | No | Please select from the followingstandardDNS Seed List(SRV) If you are using MongoDB Atlas, please select **DNS Seed List (SRV)**. For more information on connection types, please refer to [the official documentation - Connection String URI Format](https://www.mongodb.com/docs/manual/reference/connection-string/). | | host | Yes | Enter a host name or IP address. | | destination port | Yes | Enter the port number of the database to connect to. The default port number for MongoDB is `27017`. | | Authentication method | No | Please select from the following - SCRAM_SHA_1 - MONGODB_CR - Based on server version - Version 3.0 or higher: Use SCRAM_SHA_1. - For versions less than 3.0: Use MONGODB_CR. For more information on authentication methods, please refer to [the official documentation - Authentication.](https://www.mongodb.com/docs/ruby-driver/master/reference/authentication/) | | user | No | Please enter a user name for authentication. | | (computer) password | No | Please enter the password for authentication. | | Authentication database | No | Please enter the authentication database (authSource). If not specified, it will be `admin.` | | Read settings | Yes | Please choose one of the options. The default is `PRIMARY`. See "About Read Preferences" below for more information about read preferences. | MongoDB authentication settings MongoDB can be connected to without user authentication settings. However, TROCCO recommends that you set up user authentication. ## About Read Preferences For more information on read preferences, please refer to the [official documentation - Read Preference](https://www.mongodb.com/docs/manual/core/read-preference/). | Selection | Content | | --- | --- | | primary | (default) Routes all read operations to the primary node of the current replica set. | | primaryPreferred | Route all read operations to the primary node. If the primary is unavailable, such as during automatic failover, read requests are routed to the secondary node instead. | | secondary | Routes all read operations to one of the secondary nodes. | | secondaryPreferred | Routes all read operations to one of the available secondary nodes. If the secondary is not available, it is routed to the primary instead. | | nearest | The node with the lowest network latency is selected for routing. Primary and secondary are treated equally. |