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 sizeOfDocument #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

acondolu
Copy link

@acondolu acondolu commented May 10, 2024

This PR adds sizeOfDocument function, that computes the size in bytes of a BSON document without having to serialise it to binary format.

I wrote it for mongodb project, where MongoDB bulk insertion needs to estimate the size of the documents to be inserted before serialising them (trying to remain under the MongoDB maximum query limit).

I also tried to add a QuickCheck test, but I'm not sure it's working as expected... I tried to tweak the QuickCheck options to avoid huge arbitrary generated documents, but I'm not sure that's the right approach.

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.

1 participant