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

fix: make inspection result of Binary evaluatable NODE-2947 #416

Merged
merged 3 commits into from
Dec 4, 2020

Conversation

addaleax
Copy link
Contributor

@addaleax addaleax commented Dec 4, 2020

Make sure that evaluating the inspection result of a Binary object
returns a result that can be evaluated to give an object equivalent
to the original.

Make sure that evaluating the inspection result of a `Binary` object
returns a result that can be evaluated to give an object equivalent
to the original.
Copy link
Contributor

@nbbeeken nbbeeken 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 this! it makes sense that the inspect prints should be "round-trippable" so to speak for debugging.
Sorry to increase scope on you but would you mind adding Decimal128 to this fix?

currently it outputs:

> BSON.Decimal128.fromString('12345')
Decimal128('12345')
// But the constructor takes a sequence of bytes not a string:
> Decimal128('12345')
Decimal128("2.1542142465E-6166") // bad value

It should have the fromString() call on the end instead.

Would it also make sense to add new to the beginning of the inspect strings?

@addaleax
Copy link
Contributor Author

addaleax commented Dec 4, 2020

@nbbeeken Sure, done!

Would it also make sense to add new to the beginning of the inspect strings?

Well, yes, but I also didn't want to increase the scope here too much. Also done! :)

Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

LGTM, I'll merge when we get the ✅ :)

@nbbeeken nbbeeken merged commit 616665f into mongodb:master Dec 4, 2020
@addaleax addaleax deleted the 2947-dev branch December 4, 2020 20:37
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.

3 participants