Skip to content
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

Open
wants to merge 10 commits into
base: cpp-standardization
Choose a base branch
from

Conversation

norareidy
Copy link
Collaborator

@norareidy norareidy commented Jun 28, 2024

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

  • Is this free of any warnings or errors in the RST?
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?

@norareidy norareidy changed the title Docsp 40801 count DOCSP-40801: Count documents Jun 28, 2024
Copy link
Collaborator

@rustagir rustagir left a 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!

// 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;
Copy link
Collaborator

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

Suggested change
std::cout << "Number of documents: " << result << std::endl;
std::cout << "Number of companies founded in 2010: " << result << std::endl;

Comment on lines 63 to 65
.. code-block:: cpp

auto count = collection.count_documents({})
Copy link
Collaborator

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?

Copy link
Collaborator Author

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


.. output::

Number of documents: 100
Copy link
Collaborator

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

@norareidy norareidy requested a review from kevinAlbs July 1, 2024 21:24
@kevinAlbs kevinAlbs requested review from eramongodb and removed request for kevinAlbs July 2, 2024 20:27
Comment on lines +43 to +44
To learn how to create a free MongoDB Atlas cluster and load the sample datasets, see the
:ref:`<cpp-get-started>` tutorial.
Copy link
Collaborator

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)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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.

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.

None yet

3 participants