Skip to content

Conversation

@tcannon91
Copy link
Contributor

Match output with legacy mongo shell for toString method

Jira ticket: https://jira.mongodb.org/browse/STREAMS-1983

assert.strictEqual(maxLong.compare(nl2), 1);
const decimal = NumberDecimal("1.1");
assert.strictEqual(decimal.toString(), 'NumberDecimal("1.1")');
assert.strictEqual(decimal.tojson(), '1.1');
Copy link
Collaborator

Choose a reason for hiding this comment

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

root@bce3f00f5209:/# mongo --nodb
MongoDB shell version v5.0.31
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
> NumberDecimal('1.1').tojson()
NumberDecimal("1.1")

seems to disagree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, sorry I was focused on maintaining the previous output, not compatibility. Will update

@addaleax addaleax merged commit f23c34f into mongodb-labs:main Oct 15, 2025
3 checks passed
@addaleax
Copy link
Collaborator

published in @mongosh/[email protected]

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