[GODRIVER-2080] Document client.StartSession does not error on disconnected client Created: 14/Jul/21 Updated: 28/Oct/23 Resolved: 29/Jul/21 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Connections |
| Affects Version/s: | None |
| Fix Version/s: | 1.7.1 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Marco Ottina | Assignee: | Benji Rewis (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | post-5.0 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Documentation Changes: | Not Needed |
| Description |
|
The invocation of `client.StartSession( aContext )` over a `*mongo.Client` should produce an error if the client has been previously disconnected (through `client.Disconnect( aContext )` ). Am I missing something from the DOCS?The invocation of `client.StartSession( aContext )` over a `*mongo.Client` should produce an error if the client has been previously disconnected (through `client.Disconnect( aContext )` ). Am I missing something from the DOCS? ``` func main() { err = clientMongo.Disconnect(context.Background()) // let simulate a connection loss // every operations over a Collection (obtained before the Disconnect) will now fail with an error, as expected } |
| Comments |
| Comment by Githook User [ 03/Aug/21 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Benji Rewis (Inactive) [ 29/Jul/21 ] |
|
Updated documentation will be available in version 1.7.1 of the Go driver. |
| Comment by Githook User [ 29/Jul/21 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Marco Ottina [ 29/Jul/21 ] |
|
Thank you so much for your kind help and replies. |
| Comment by Benji Rewis (Inactive) [ 29/Jul/21 ] |
|
No problem. Here's a PR to document this behavior on client.StartSession https://github.com/mongodb/mongo-go-driver/pull/709 |
| Comment by Marco Ottina [ 29/Jul/21 ] |
|
First of all, thank you so much for your reply. It would be great if You would add that line to the Docs. Thank you so much. |
| Comment by Benji Rewis (Inactive) [ 28/Jul/21 ] |
|
Hello ottins1995@gmail.com! Thanks again for your report. Client.StartSession begins a session in the driver; it does not actually reach out to the server. StartSession simply constructs a new sessionImpl with the correct options and returns it to the caller. Because it does not reach out to the server, the StartSession method will not know that the client is currently disconnected, so it cannot return that error. However, attempting to use the session created in StartSession to communicate with the server should result in a mongo.ErrClientDisconnected. If it would be helpful, we can add a small line in the documentation for that method clarifying that it does not actually perform any network calls. |
| Comment by Kevin Albertson [ 15/Jul/21 ] |
|
Hello ottins1995@gmail.com, thank you for the report! We will further investigate this after we have completed high priority work for upcoming server support. Thank you for your patience. |