Skip to content

Commit

Permalink
GODRIVER-2080 Document that StartSession does not error on disconnect…
Browse files Browse the repository at this point in the history
…ed client (#709)
  • Loading branch information
benjirewis authored and Benjamin Rewis committed Aug 3, 2021
1 parent ec0cc6f commit 50c091a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mongo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ func (c *Client) Ping(ctx context.Context, rp *readpref.ReadPref) error {

// StartSession starts a new session configured with the given options.
//
// StartSession does not actually communicate with the server and will not error if the client is
// disconnected.
//
// If the DefaultReadConcern, DefaultWriteConcern, or DefaultReadPreference options are not set, the client's read
// concern, write concern, or read preference will be used, respectively.
func (c *Client) StartSession(opts ...*options.SessionOptions) (Session, error) {
Expand Down

1 comment on commit 50c091a

@lonevetad
Copy link

@lonevetad lonevetad commented on 50c091a Aug 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I suggests to add, as a tip, the following line:
"
Use the client.Ping( context ) function to spot a disconnection.
"

Please sign in to comment.