Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Created by Guest
Created on Jul 28, 2020

Add non-EJSON as option for json utils

python and other drivers offer to-json utils. This makes taking a native rich shape complete with datetimes and byte[] and such and easily turning into bson (the best way!) or JSON. The utils offer options to modify the output representations of types but always do so in an EJSON way, namely with $date/$numberDecimal etc. Sometimes a consumer cannot (or will not) accept data in this fashion. I'd like to see a "safePureJSON" option (or similar) for bson.json_utils.dumps() that emits the safe string or number equivalent of the EJSON. fld: {$date: "ISOdate"} becomes fld: "ISOdate" fld: {$numberDecimal: "99.9"} becomes fld: "99.9" (string, to prevent float parse issues) fld: {$numberLong: "1234567890123456"} becomes fld: 1234567890123456 float and int32 are not a problem. Not as much of a issue for $binary because the extra info is probably helpful for the decoding rather than a hindrance.