Skip to content

GODRIVER-2010 Further clean up documentation examples #915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 20, 2022
Merged

GODRIVER-2010 Further clean up documentation examples #915

merged 7 commits into from
Apr 20, 2022

Conversation

benjirewis
Copy link
Contributor

GODRIVER-2010

Adds a README to examples/documentation_examples explaining the purpose of examples.go and examples_test.go. Replaces context.Background() with context.TODO() is actual example code. Actually runs WithTransactionExample. Uses mtest.ClusterURI() instead of hard-coding URIs. Reorganizes examples_test.go to use mtest for server version/topology logic. Adds links to examples pointing to where they appear/will appear on www.mongodb.com/docs.

Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

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

Awesome docs improvements! @benjirewis do we need to do anything to get these rendered in the docs website?

Copy link
Contributor Author

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

@matthewdale let me check with the docs team. I believe they just pull from the current state of the Go driver on master, though.

if err != nil {
return err
}
defer session1.EndSession(context.TODO())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CausalConsistencyExamples actually left two sessions (session1 and session2) checked out. We always want to defer session.EndSession() when using StartSession. Apologies for not catching this in the initial review, @prestonvasquez. Now that this example is run through mtest, it was failing because two sessions were still checked out.

@benjirewis benjirewis merged commit db84b1d into mongodb:master Apr 20, 2022
@benjirewis benjirewis deleted the cleanupExamples.2010 branch April 20, 2022 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants