-
Notifications
You must be signed in to change notification settings - Fork 544
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
CXX-2582 revise tutorial #940
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CXX-894 is resolved
It is not output by pkg-config for libmongocxx and is not necessary for an application
The invalid JSON values are rendered highlighted in black.
Fixes `error: no member named 'to_string' in 'std::string_view'`
This is requested in the ticket.
Use of the stream builder is documented as discouraged. The basic builder syntax is more succinct.
To shorten the output
To fix `-Wunused-variable` warnings
This is the default behavior unless overridden with an unacknowledged write concern.
C++ driver 3.7.0 depends on C driver 1.22.1. C driver 1.22.1 supports MongoDB versions 3.6+. The docs compatibility table here is incorrect: https://www.mongodb.com/docs/drivers/cxx/#mongodb-compatibility
To further simplify example.
Release builds may undefine the assert macro and result in -Wunused-variable warnings.
kkloberdanz
approved these changes
Mar 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
rcsanchez97
approved these changes
Mar 10, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with one minor typo fix.
Co-authored-by: Roberto C. Sánchez <roberto@connexer.com>
kevinAlbs
added a commit
that referenced
this pull request
Mar 13, 2023
* remove outdated comment CXX-894 is resolved * remove libmongoc and libbson include headers It is not output by pkg-config for libmongocxx and is not necessary for an application * fix rendering of invalid JSON The invalid JSON values are rendered highlighted in black. * add initial tutorial * rename `coll` to `collection` * use `collection`, not `restaurants` * use `string_view`, not `string` Fixes `error: no member named 'to_string' in 'std::string_view'` * use `view`, not `doc` * use `auto` * distinguish result variables * show example of getting insert ids This is requested in the ticket. * add scopes and comments * use inline document * replace stream builder with basic builder Use of the stream builder is documented as discouraged. The basic builder syntax is more succinct. * make less documents To shorten the output * drop collection to clean up * rename `view` to `doc_view` * add assertions on unused variables To fix `-Wunused-variable` warnings * assert writes return results This is the default behavior unless overridden with an unacknowledged write concern. * update "versions" array to reflect supported versions C++ driver 3.7.0 depends on C driver 1.22.1. C driver 1.22.1 supports MongoDB versions 3.6+. The docs compatibility table here is incorrect: https://www.mongodb.com/docs/drivers/cxx/#mongodb-compatibility * fix assert * use only three documents in tutorial To further simplify example. * use assert instead of printing * add example of printing all documents * remove TODO comment * remove whitespace * note requirement of get_utf8 in C++ driver < 3.7.0 * apply changes to tutorial.md * fix assert define check * move redefinition of `assert` macro Release builds may undefine the assert macro and result in -Wunused-variable warnings. * Update docs/content/mongocxx-v3/tutorial.md Co-authored-by: Roberto C. Sánchez <roberto@connexer.com> --------- Co-authored-by: Roberto C. Sánchez <roberto@connexer.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
tutorial.cpp
with code snippets fromtutorial.md
.coll
tocollection
.tutorial.cpp
. Notably:tutorial.cpp
totutorial.md
.Background & Motivation
Adding
tutorial.cpp
with assertions is intended to make it easier to verify correctness of tutorial code snippets.Changes were applied to
tutorial.cpp
in separate commits. Commit messages describe some of the rationale.Documentation can be built locally with
cmake --build cmake-build --target hugo
and viewed withopen ./build/hugo/mongocxx-v3/tutorial/index.html
.Evergreen appears to not be receiving GitHub checks at the moment. Here is an Evergreen patch build with these changes.