Skip to content

Mongosh compatibility#169

Merged
zhangyaoxing merged 4 commits intomasterfrom
mongosh-compatibility
Mar 18, 2026
Merged

Mongosh compatibility#169
zhangyaoxing merged 4 commits intomasterfrom
mongosh-compatibility

Conversation

@zhangyaoxing
Copy link
Copy Markdown
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.

@zhangyaoxing zhangyaoxing merged commit b89b18d into master Mar 18, 2026
1 check passed
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