-
Notifications
You must be signed in to change notification settings - Fork 9
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
DOCSP-40801: Count documents #27
base: cpp-standardization
Are you sure you want to change the base?
DOCSP-40801: Count documents #27
Conversation
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.
A few small things, doesnt need a second look unless you want!
source/includes/read/count.cpp
Outdated
// Counts documents that have a "founded_year" value of 2010 | ||
// start-count-accurate | ||
auto result = collection.count_documents(make_document(kvp("founded_year", 2010))); | ||
std::cout << "Number of documents: " << result << std::endl; |
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.
S: give more descrriptive output
std::cout << "Number of documents: " << result << std::endl; | |
std::cout << "Number of companies founded in 2010: " << result << std::endl; |
source/read/count.txt
Outdated
.. code-block:: cpp | ||
|
||
auto count = collection.count_documents({}) |
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.
Q: why not include this in the code file as well? Also why not include a print statement?
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.
moved to the code file & added output - it seemed like a basic syntax example, but I think it still benefits from those changes
source/read/count.txt
Outdated
|
||
.. output:: | ||
|
||
Number of documents: 100 |
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.
S: make output more descriptive
To learn how to create a free MongoDB Atlas cluster and load the sample datasets, see the | ||
:ref:`<cpp-get-started>` tutorial. |
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.
Is this reference correct? I do not think the "Get Started with the C++ Driver" pages are relevant to creating a free MongoDB Atlas cluster.
// start-modify-accurate | ||
mongocxx::options::count opts; | ||
opts.limit(100); | ||
auto result = collection.count_documents(make_document(kvp("number_of_employees", 50))); |
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.
auto result = collection.count_documents(make_document(kvp("number_of_employees", 50))); | |
auto result = collection.count_documents(make_document(kvp("number_of_employees", 50)), opts); |
Missing opts
argument specifying the limit set above.
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-40801
Staging - https://preview-mongodbnorareidy.gatsbyjs.io/cpp-driver/DOCSP-40801-count/read/count/
Self-Review Checklist