[SERVER-24146] JSON.stringify emits empty document for NumberLong fields Created: 16/May/16  Updated: 28/Sep/16  Resolved: 15/Aug/16

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 3.3.2
Fix Version/s: 3.3.12

Type: Bug Priority: Major - P3
Reporter: Bruce Lucas (Inactive) Assignee: Adam Chelminski (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-8917 JSON.stringify emits empty document f... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Sprint: Platforms 18 (08/05/16), Platforms 2016-08-26
Participants:

 Description   

> mongo --eval "JSON.stringify({x: NumberLong(3)})"
MongoDB shell version: 3.3.5
connecting to: test
{"x":{}}

This is a regression from 3.2:

> mongo --eval "JSON.stringify({x: NumberLong(3)})"
MongoDB shell version: 3.2.6
connecting to: test
{"x":{"floatApprox":3}}



 Comments   
Comment by Adam Chelminski (Inactive) [ 15/Aug/16 ]

Calling the native JS function "JSON.stringify" on a BSON object in the shell will now print the strict JSON representation of that object (except for the BSON undefined type, and the BSON date type, due to the fact that those are represented in the shell as native JS objects/types that have existing JSON representations).

Calling the new function "tostrictjson" on a BSON object in the shell will print the strict JSON representation of that object (including for the BSON undefined type, and the BSON date type).

Comment by Githook User [ 15/Aug/16 ]

Author:

{u'username': u'adamchel', u'name': u'Adam Chelminski', u'email': u'adam.chelminski@mongodb.com'}

Message: SERVER-24146 Fix JSON.stringify regression, and add new "tostrictjson" shell util function for printing strict JSON
Branch: master
https://github.com/mongodb/mongo/commit/df4248d69bd6643925d0e9cc62c6be3adf7750d7

Generated at Thu Feb 08 04:05:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.