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

Add support for BSON element 11: uint64 #4380

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

slowriot
Copy link

@slowriot slowriot commented May 24, 2024

This PR adds support for decoding and encoding BSON element 11: 64bit unsigned int.

This resolves #3894.

Changes

  • Decode element 0x11 correctly as uint64_t.
  • Update existing write_bson_unsigned to encode unsigned 64bit values correctly (using 0x11 instead of signed 0x12).
  • Update existing tests to expect support for uint64_t.

Reference

Pull request checklist

  • Changes are described in the pull request, or an existing issue is referenced.
  • The test suite compiles and runs without error.
  • Code coverage is 100%. Test cases can be added by editing the test suite.
  • The source code is amalgamated; that is, after making changes to the sources in the include/nlohmann directory, run make amalgamate to create the single-header files single_include/nlohmann/json.hpp and single_include/nlohmann/json_fwd.hpp. The whole process is described here.

@coveralls
Copy link

Coverage Status

coverage: 99.984% (-0.02%) from 100.0%
when pulling 7c616a2 on slowriot:bson-element-11-uint64
into 8c391e0 on nlohmann:develop.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

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

Thanks for the patience. The code looks good, but the documentation needs adjustment:

@slowriot
Copy link
Author

slowriot commented Nov 7, 2024

Thanks for the patience. The code looks good, but the documentation needs adjustment:

Thanks for the review. Documentation updated in latest. Please let me know if I've missed anything else.

@coveralls
Copy link

coveralls commented Nov 7, 2024

Coverage Status

coverage: 99.984% (-0.02%) from 100.0%
when pulling 5345c07 on slowriot:bson-element-11-uint64
into 8c391e0 on nlohmann:develop.

@nlohmann
Copy link
Owner

nlohmann commented Nov 7, 2024

Coverage went down. Can you please check if a test is missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

json::to_bson does not handle unsigned 64 bit integers
3 participants