[GODRIVER-2699] Accept exactly one "ClientOptions" in "mongo.Connect" Created: 16/Dec/22  Updated: 08/Jan/24

Status: Blocked
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on GODRIVER-2696 Allow only 0 or 1 options structs in ... Investigating
Epic Link: Go Driver 2.0: Driver
Backwards Compatibility: Major Change
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Currently mongo.Connect accepts a variadic argument for the ClientOptions value(s). However, there are no known use cases where multiple ClientOptions need to be passed in and very few where zero ClientOptions need to be passed. As a result, the options.MergeClientOptions function is almost never used, despite requiring maintenance and testing. Remove the ability to pass zero or many ClientOptions structs and remove options.MergeClientOptions.

Definition of done:

  • Update mongo.Connect to accept a single options.ClientOptions argument instead of any number of arguments.
  • Update the mongo.Connect docs to describe default behavior when a zero-value options.ClientOptions struct is passed (existing default behavior is the same, just different syntax). Note that this may not require any changes.
  • Remove options.MergeClientOptions.


 Comments   
Comment by Matt Dale [ 04/Nov/23 ]

Note that this may be unnecessary depending on the outcome of GODRIVER-2696. If we use a pattern that doesn't require merging options structs but still supports variadic options args, it's possible we could still support variadic args for Connect.

Generated at Thu Feb 08 08:39:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.