<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:55:09 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>[JAVA-1652] Valid JS output?</title>
                <link>https://jira.mongodb.org/browse/JAVA-1652</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;We use the Java driver to make requests against MongoDB instances, but also to output the JS that a user would have to execute to perform the same operation themselves (EG, in the mongo console). Using `toString` generally works &#8211; BasicDBObjects look like &lt;/p&gt;
{&quot;key&quot;: value}
&lt;p&gt;, etc. But `bson.types.Code` ends up outputting something like `{&quot;scope&quot;: {&quot;myFun&quot;: {&quot;$code&quot;: &quot;function () &lt;/p&gt;
{&#8230;}
&lt;p&gt;&quot;}}}`, when it should be `{&quot;scope&quot;: {&quot;myFun&quot;: function () {&#8230;}}}}`.&lt;/p&gt;

&lt;p&gt;So &#8230;&#160;are we abusing toString too much? Is there some other operation that we can use to get the appropriate output? Or do we have to write the JS-compatible version ourselves?&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</description>
                <environment></environment>
        <key id="183856">JAVA-1652</key>
            <summary>Valid JS output?</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="-1">Unassigned</assignee>
                                    <reporter username="sellout">Greg Pfeil</reporter>
                        <labels>
                    </labels>
                <created>Thu, 12 Feb 2015 04:50:41 +0000</created>
                <updated>Wed, 11 Sep 2019 19:10:11 +0000</updated>
                            <resolved>Thu, 12 Feb 2015 14:03:26 +0000</resolved>
                                    <version>2.13.0</version>
                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="827590" author="ross@10gen.com" created="Thu, 12 Feb 2015 07:02:06 +0000"  >&lt;p&gt;Hi Greg,&lt;/p&gt;

&lt;p&gt;The Java driver uses &lt;a href=&quot;http://docs.mongodb.org/manual/reference/mongodb-extended-json/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;extended json&lt;/a&gt; so that information isn&apos;t lost and that the Json we produce can be round tripped back to a Document and this is why you are seeing the &lt;tt&gt;$code&lt;/tt&gt; and function as a string. &lt;br/&gt;
There isn&apos;t a serializer in the 2.x versions of the driver that produce shell compatible javascript but it has been added in the 3.x branch which is currently in beta.&lt;/p&gt;

&lt;p&gt;For future, the best place for questions regarding MongoDB usage or the Java driver specifics is the &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user mailinglist&lt;/a&gt; or &lt;a href=&quot;http://stackoverflow.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stackoverflow&lt;/a&gt; as you will reach a boarder audience there.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;
</comment>
                    </comments>
                    <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|hs68nr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>161638</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>