@@ -87,27 +87,19 @@ type Client struct {
87
87
authenticator driver.Authenticator
88
88
}
89
89
90
- // Connect creates a new Client and then initializes it using the Connect method .
90
+ // Connect creates a new Client with the given configuration options .
91
91
//
92
- // When creating an options.ClientOptions, the order the methods are called matters. Later Set*
93
- // methods will overwrite the values from previous Set* method invocations. This includes the
94
- // ApplyURI method. This allows callers to determine the order of precedence for option
95
- // application. For instance, if ApplyURI is called before SetAuth, the Credential from
96
- // SetAuth will overwrite the values from the connection string. If ApplyURI is called
97
- // after SetAuth, then its values will overwrite those from SetAuth.
92
+ // Connect returns an error if the configuration options are invalid, but does
93
+ // not validate that the MongoDB deployment is reachable. To verify that the
94
+ // deployment is reachable, call [Client.Ping].
98
95
//
99
- // The opts parameter is processed using options.MergeClientOptions, which will overwrite entire
100
- // option fields of previous options, there is no partial overwriting. For example, if Username is
101
- // set in the Auth field for the first option, and Password is set for the second but with no
102
- // Username, after the merge the Username field will be empty.
103
- //
104
- // The NewClient function does not do any I/O and returns an error if the given options are invalid.
105
- // The Client.Connect method starts background goroutines to monitor the state of the deployment and does not do
106
- // any I/O in the main goroutine to prevent the main goroutine from blocking. Therefore, it will not error if the
107
- // deployment is down.
108
- //
109
- // The Client.Ping method can be used to verify that the deployment is successfully connected and the
110
- // Client was correctly configured.
96
+ // When creating an [options.ClientOptions], the order the methods are called
97
+ // matters. Later option setter calls overwrite the values from previous option
98
+ // setter calls, including the ApplyURI method. This allows callers to
99
+ // determine the order of precedence for setting options. For instance, if
100
+ // ApplyURI is called before SetAuth, the Credential from SetAuth will
101
+ // overwrite the values from the connection string. If ApplyURI is called
102
+ // after SetAuth, then its values will overwrite those from SetAuth.
111
103
func Connect (opts ... * options.ClientOptions ) (* Client , error ) {
112
104
c , err := newClient (opts ... )
113
105
if err != nil {
0 commit comments