-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Connections
-
Not Needed
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?
To reproduce:
```
import (
"fmt"
"context"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
clientMongo, err := mongo.Connect(context.Background(), options.Client().ApplyURI( someUriYouProvide ))
if err != nil
err = clientMongo.Disconnect(context.Background()) // let simulate a connection loss
if err != nil
// every operations over a Collection (obtained before the Disconnect) will now fail with an error, as expected
mongoSession, err := clientMongo.StartSession()
if err == nil
}
```