Skip to content

Conversation

@zhangyaoxing
Copy link
Collaborator

The JSON.stringify of mongosh is very different from that in legacy shell. As a result, the output of some bson types are messed up. Examples:

BSON Object Current Output Expected Output
Timestamp(1765308820, 1) {"$timestamp":"7581943490326560768"} {$timestamp: { t: 1765308820, i: 1 }}
Date(1765308820000) "2025-12-09T19:33:40.802Z" {$date: 1765308820000}

To fix the output, EJSON.stringify is used instead, with some customization.
The source code is accidentally formatted so has a lot of changes. But the lines changed are only line 284~298.

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