<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:10:11 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-652] Number formatting and whitespace in bson_as_json</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-652</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;I am implementing a client version of `mongoexport` in the R driver, which uses bson_as_json to convert bson records to json lines which are then streamed into file or connection. It works, but the bson to json conversion is suboptimal.&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;5555102760f0cc03b65c8331&quot; }, &quot;Sepal.Length&quot; : 5.100000, &quot;Sepal.Width&quot; : 3.500000, &quot;Petal.Length&quot; : 1.400000, &quot;Petal.Width&quot; : 0.200000, &quot;Species&quot; : &quot;setosa&quot; }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;5555102760f0cc03b65c8332&quot; }, &quot;Sepal.Length&quot; : 4.900000, &quot;Sepal.Width&quot; : 3, &quot;Petal.Length&quot; : 1.400000, &quot;Petal.Width&quot; : 0.200000, &quot;Species&quot; : &quot;setosa&quot; }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;5555102760f0cc03b65c8333&quot; }, &quot;Sepal.Length&quot; : 4.700000, &quot;Sepal.Width&quot; : 3.200000, &quot;Petal.Length&quot; : 1.300000, &quot;Petal.Width&quot; : 0.200000, &quot;Species&quot; : &quot;setosa&quot; }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;There are at least two issues. First there is unnecessary whitespace, which is undesired. A bigger issue is the number formatting. It seems like libbson prints doubles with fixed digits which results in trailing zero&apos;s or loss of precision for small numbers.&lt;/p&gt;

&lt;p&gt;By comparison, the real `mongoexport` utility outputs this for the same data:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&quot;Petal.Length&quot;:1.4,&quot;Petal.Width&quot;:0.2,&quot;Sepal.Length&quot;:5.1,&quot;Sepal.Width&quot;:3.5,&quot;Species&quot;:&quot;setosa&quot;,&quot;_id&quot;:{&quot;$oid&quot;:&quot;5555102760f0cc03b65c8331&quot;}}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&quot;Petal.Length&quot;:1.4,&quot;Petal.Width&quot;:0.2,&quot;Sepal.Length&quot;:4.9,&quot;Sepal.Width&quot;:NumberInt(3),&quot;Species&quot;:&quot;setosa&quot;,&quot;_id&quot;:{&quot;$oid&quot;:&quot;5555102760f0cc03b65c8332&quot;}}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&quot;Petal.Length&quot;:1.3,&quot;Petal.Width&quot;:0.2,&quot;Sepal.Length&quot;:4.7,&quot;Sepal.Width&quot;:3.2,&quot;Species&quot;:&quot;setosa&quot;,&quot;_id&quot;:{&quot;$oid&quot;:&quot;5555102760f0cc03b65c8333&quot;}}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Ideally output from bson_as_json would be identical to mongoexport, but I understand yajl might have its limitations.&lt;/p&gt;</description>
                <environment></environment>
        <key id="204344">CDRIVER-652</key>
            <summary>Number formatting and whitespace in bson_as_json</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="Jeroenooms">Jeroen Ooms [X]</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 May 2015 21:51:38 +0000</created>
                <updated>Mon, 30 Sep 2019 21:48:10 +0000</updated>
                            <resolved>Fri, 29 May 2015 19:02:05 +0000</resolved>
                                                    <fixVersion>1.2-beta0</fixVersion>
                                    <component>json</component>
                    <component>libbson</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1320678" author="jesse" created="Mon, 11 Jul 2016 21:05:17 +0000"  >&lt;p&gt;Thanks for the info! Right now, none of the drivers distinguish ints from floats when they &lt;b&gt;export&lt;/b&gt; JSON. We may change our minds in the future.&lt;/p&gt;</comment>
                            <comment id="1320605" author="jeroenooms" created="Mon, 11 Jul 2016 20:18:29 +0000"  >&lt;p&gt;Here is an old issue but I found that yajl also exports doubles with at least one decimal to distingiush them from integers. It does so simply by first printing the number, and then adding `.0` if the number only consists of `-0123456789` characters: &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/libbson/blob/e1c1516a64a39cc0cb8b9c31b14099a3c926cfb0/src/yajl/yajl_gen.c#L233-L236&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/blob/e1c1516a64a39cc0cb8b9c31b14099a3c926cfb0/src/yajl/yajl_gen.c#L233-L236&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This seems more reliable than fmod and also prevents the problems above when doubles get printed in scientific notation.&lt;/p&gt;</comment>
                            <comment id="1131648" author="xgen-internal-githook" created="Mon, 11 Jan 2016 22:01:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-652&quot; title=&quot;Number formatting and whitespace in bson_as_json&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-652&quot;&gt;&lt;del&gt;CDRIVER-652&lt;/del&gt;&lt;/a&gt; just use &quot;%g&quot; for floats in bson_as_json&lt;br/&gt;
Branch: 1.3.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1131647" author="xgen-internal-githook" created="Mon, 11 Jan 2016 22:01:37 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-652&quot; title=&quot;Number formatting and whitespace in bson_as_json&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-652&quot;&gt;&lt;del&gt;CDRIVER-652&lt;/del&gt;&lt;/a&gt; nicer float format in bson_as_json&lt;/p&gt;

&lt;p&gt;Format with flexible precision after the decimal point, and for convenience&lt;br/&gt;
always include one digit after the point if the BSON type is double.&lt;br/&gt;
Branch: 1.3.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/eeb6192ad8f83d20fbde2f2c515692649dd5dc76&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/eeb6192ad8f83d20fbde2f2c515692649dd5dc76&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1065686" author="xgen-internal-githook" created="Tue, 20 Oct 2015 15:38:49 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-652&quot; title=&quot;Number formatting and whitespace in bson_as_json&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-652&quot;&gt;&lt;del&gt;CDRIVER-652&lt;/del&gt;&lt;/a&gt; just use &quot;%g&quot; for floats in bson_as_json&lt;br/&gt;
Branch: debian&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1065685" author="xgen-internal-githook" created="Tue, 20 Oct 2015 15:38:48 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-652&quot; title=&quot;Number formatting and whitespace in bson_as_json&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-652&quot;&gt;&lt;del&gt;CDRIVER-652&lt;/del&gt;&lt;/a&gt; nicer float format in bson_as_json&lt;/p&gt;

&lt;p&gt;Format with flexible precision after the decimal point, and for convenience&lt;br/&gt;
always include one digit after the point if the BSON type is double.&lt;br/&gt;
Branch: debian&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/eeb6192ad8f83d20fbde2f2c515692649dd5dc76&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/eeb6192ad8f83d20fbde2f2c515692649dd5dc76&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1054625" author="xgen-internal-githook" created="Wed, 7 Oct 2015 21:59:29 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-652&quot; title=&quot;Number formatting and whitespace in bson_as_json&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-652&quot;&gt;&lt;del&gt;CDRIVER-652&lt;/del&gt;&lt;/a&gt; &quot;%g&quot; for floats in bson_as_json in 1.2.x&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/9eb14d12c8a3495e0c99f2fb6238167f050df559&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/9eb14d12c8a3495e0c99f2fb6238167f050df559&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1049131" author="xgen-internal-githook" created="Thu, 1 Oct 2015 20:16:21 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-652&quot; title=&quot;Number formatting and whitespace in bson_as_json&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-652&quot;&gt;&lt;del&gt;CDRIVER-652&lt;/del&gt;&lt;/a&gt; just use &quot;%g&quot; for floats in bson_as_json&lt;br/&gt;
Branch: 1.2.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1049130" author="xgen-internal-githook" created="Thu, 1 Oct 2015 20:16:20 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-652&quot; title=&quot;Number formatting and whitespace in bson_as_json&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-652&quot;&gt;&lt;del&gt;CDRIVER-652&lt;/del&gt;&lt;/a&gt; nicer float format in bson_as_json&lt;/p&gt;

&lt;p&gt;Format with flexible precision after the decimal point, and for convenience&lt;br/&gt;
always include one digit after the point if the BSON type is double.&lt;br/&gt;
Branch: 1.2.0-dev&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libbson/commit/eeb6192ad8f83d20fbde2f2c515692649dd5dc76&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/eeb6192ad8f83d20fbde2f2c515692649dd5dc76&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="927708" author="jesse" created="Fri, 29 May 2015 19:02:01 +0000"  >&lt;p&gt;1.2.0: &lt;a href=&quot;https://github.com/mongodb/libbson/commit/9eb14d12c8a3495e0c99f2fb6238167f050df559&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/9eb14d12c8a3495e0c99f2fb6238167f050df559&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1.1.7: &lt;a href=&quot;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/2fd5fb266f6280855e80eea527e9b87007e98f1f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="927674" author="jeroenooms" created="Fri, 29 May 2015 18:35:20 +0000"  >&lt;p&gt;I hope that means &lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;%.15g&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt; for all doubles &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="927670" author="jesse" created="Fri, 29 May 2015 18:30:52 +0000"  >&lt;p&gt;I now agree with you, and additionally think it should &lt;b&gt;not&lt;/b&gt; be a goal to distinguish ints and doubles. I&apos;ll do the simplest thing possible that conforms with the JSON spec.&lt;/p&gt;</comment>
                            <comment id="926766" author="jeroenooms" created="Thu, 28 May 2015 22:07:14 +0000"  >&lt;p&gt;Actually I take that back, I don&apos;t think forcing a decimal notation for doubles is a good idea. It leads to really poor formatting for large numbers. For example with the current implementation, the numbers 10^25 up till 10^30 are printed with a lot of non-significant noise:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbe8&quot; }, &quot;x&quot; : 10000000000000000905969664.0 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbe9&quot; }, &quot;x&quot; : 100000000000000004764729344.0 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbea&quot; }, &quot;x&quot; : 1000000000000000013287555072.0 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbeb&quot; }, &quot;x&quot; : 9999999999999999583119736832.0 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbec&quot; }, &quot;x&quot; : 99999999999999991433150857216.0 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbed&quot; }, &quot;x&quot; : 1000000000000000019884624838656.0 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;With scientific notation you only get to see the actual significant digits, which is a more accurate representation of the value:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbe8&quot; }, &quot;x&quot; : 1e+25 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbe9&quot; }, &quot;x&quot; : 1e+26 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbea&quot; }, &quot;x&quot; : 1e+27 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbeb&quot; }, &quot;x&quot; : 1e+28 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbec&quot; }, &quot;x&quot; : 1e+29 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;556790b7ba7cb2118851dbed&quot; }, &quot;x&quot; : 1e+30 }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I think it&apos;s better to stick with scientific notation for all numbers, which works for both very large and very small numbers, and only prints actual signal from the number.&lt;/p&gt;</comment>
                            <comment id="926669" author="jeroenooms" created="Thu, 28 May 2015 21:06:55 +0000"  >&lt;p&gt;Looks good. I haven&apos;t tested this yet, but if you make yajl parse whole numbers into integers then you can probably roundtrip numbers without loss of type, which would be very nice.&lt;/p&gt;</comment>
                            <comment id="926637" author="jesse" created="Thu, 28 May 2015 20:40:28 +0000"  >&lt;p&gt;Thanks for the fix. Additionally I added, for convenience, something mongoexport doesn&apos;t do: libbson&apos;s bson_as_json formats BSON doubles like &quot;1.0&quot; and integers like &quot;1&quot;. JSON doesn&apos;t distinguish between them (all numbers are floats in JSON) and mongoexport doesn&apos;t, either. Thoughts?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/libbson/commit/eeb6192a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/commit/eeb6192a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="925902" author="jeroenooms" created="Thu, 28 May 2015 14:35:57 +0000"  >&lt;p&gt;FYI the related issue with integer formatting has been resolved in mongoexport: &lt;a href=&quot;https://jira.mongodb.org/browse/TOOLS-741&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/TOOLS-741&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="915935" author="jeroenooms" created="Sat, 16 May 2015 03:42:27 +0000"  >&lt;p&gt;Yes that makes sense. I don&apos;t mind too much about whitespace, it&apos;s just a bit of overhead but not as big of a problem as the number formatting.&lt;/p&gt;</comment>
                            <comment id="915916" author="jesse" created="Sat, 16 May 2015 02:18:29 +0000"  >&lt;p&gt;Seems wise. Rather than changing how whitespace is displayed &amp;#8211; someone else&apos;s code might rely on the way it&apos;s displayed now &amp;#8211; I&apos;d prefer to fix the bug and stop there. In the future I may &lt;b&gt;add&lt;/b&gt; APIs to override options on the JSON formatter, not just whitespace but also indentation.&lt;/p&gt;</comment>
                            <comment id="914796" author="jeroenooms" created="Fri, 15 May 2015 00:38:32 +0000"  >&lt;p&gt;I was able to fix the number formatting problem: &lt;a href=&quot;https://github.com/mongodb/libbson/pull/127&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libbson/pull/127&lt;/a&gt;. It is a simple fix that changes the number formatting for real numbers to the sensible default. Hope you can find a minute to review it.&lt;/p&gt;

&lt;p&gt;Taking out the whitespace seems quite easy as well but it requires a lot of small changes and is probably a bit more controversial, so I&apos;ll leave that alone for now.&lt;/p&gt;
</comment>
                            <comment id="914730" author="jesse" created="Thu, 14 May 2015 22:58:54 +0000"  >&lt;p&gt;Thanks Jeroen, I&apos;d like to add features to the JSON generator as well, but it&apos;s low-priority in the scheme of things. The integer formatting is certainly a problem that must be fixed eventually, however.&lt;/p&gt;</comment>
                            <comment id="914679" author="jeroenooms" created="Thu, 14 May 2015 21:53:22 +0000"  >&lt;p&gt;There is actually a bug in mongoexport for integers, that is obviously not the desired behavior: &lt;a href=&quot;https://jira.mongodb.org/browse/TOOLS-741&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/TOOLS-741&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="355391">CDRIVER-2063</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="942587">CDRIVER-3377</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrf7lz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="557">C Driver 2015Q2 sprint 2</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>