Skip to content

CXX-3082 use from_json and make_array to simplify expectation expressions #1232

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 1 commit into from
Oct 10, 2024

Conversation

eramongodb
Copy link
Contributor

@eramongodb eramongodb commented Oct 10, 2024

Followup to #1208.

Simplifies existing bsoncxx examples by using bsoncxx::from_json() and bsoncxx::builder::basic::make_array() in expectation expressions for final result values. These patterns help avoid the verbose two-step "check element validity" -> "obtain element value" usually required for per-element value access.

The written-out JSON document is expected to be easier to read and understand by users than per-element access syntax. Examples of the form from_json() == from_json() (demonstrating its own behavior) is avoided. Some examples still use element access syntax (particularly array examples) in cases where it is more convenient (i.e. element type expectations).

@eramongodb eramongodb requested a review from kevinAlbs October 10, 2024 16:40
@eramongodb eramongodb self-assigned this Oct 10, 2024
@eramongodb eramongodb merged commit df97911 into mongodb:master Oct 10, 2024
69 of 76 checks passed
@eramongodb eramongodb deleted the cxx-3082-bsoncxx branch October 10, 2024 17:54
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.

2 participants