<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:44 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-1067] Rhino NativeDate not serialized properly</title>
                <link>https://jira.mongodb.org/browse/JAVA-1067</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;For this object (note &quot;when&quot; field):&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&lt;/span&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; o = {&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;    &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;_id&quot;&lt;/span&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; : id,&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;    &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;when&quot;&lt;/span&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; : &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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; Date(),&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;    &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;name&quot;&lt;/span&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;  : &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;MongoDB&quot;&lt;/span&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; + &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;def&apos;&lt;/span&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;,&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;    &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;type&quot;&lt;/span&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;  : &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;database&quot;&lt;/span&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;,&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;    &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;count&quot;&lt;/span&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; : 1,&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;    &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;info&quot;&lt;/span&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;  : {&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;        x : 203,&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;        y : 102&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;    }&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;};&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;This call:&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;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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; BasicDBObject(o);&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;Throws the following error:&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;   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;org.mozilla.javascript.WrappedException: Wrapped java.lang.IllegalArgumentException: can&apos;t serialize class org.mozilla.javascript.NativeDate &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 was a similar issue with ConsString that was fixed in the latest driver build.  The &quot;name&quot; field above should cause the ConsString instance to be passed to the function, which works.  It did not in previous version of the driver.&lt;/p&gt;

&lt;p&gt;A fix for this would be awesome.&lt;/p&gt;</description>
                <environment>rhino 1.7R5</environment>
        <key id="104077">JAVA-1067</key>
            <summary>Rhino NativeDate not serialized properly</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="mykesx">Michael Schwartz</reporter>
                        <labels>
                    </labels>
                <created>Thu, 2 Jan 2014 14:11:24 +0000</created>
                <updated>Tue, 23 Jun 2015 02:49:16 +0000</updated>
                            <resolved>Tue, 23 Jun 2015 02:49:16 +0000</resolved>
                                    <version>2.11.3</version>
                                                    <component>Codecs</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="480865" author="trisha.gee@10gen.com" created="Mon, 13 Jan 2014 11:26:38 +0000"  >&lt;p&gt;Hi Michael,&lt;/p&gt;

&lt;p&gt;I&apos;m afraid we&apos;re not going to support NativeDate in the core Java driver, for the same reason that we don&apos;t support Joda dates either - we would need to add dependencies on external libraries, and we currently have no additional dependencies and do not wish to introduce any.  I agree with your arguments for supporting NativeDate, but you could equally argue that Joda dates are at least as widely used as java.util.Date - we&apos;d love to support all these date formats but we cannot without changing our policy on external dependencies.&lt;/p&gt;

&lt;p&gt;Your comment on Nashorn is also very valid, but Java 8 also introduces the new Date/Time API for Java, which will also not be supported immediately in the new Java driver as we do not mandate Java 8 for using the driver.  We are looking at ways to easily support these different Date formats, but all of them will probably require the user&apos;s application to configure their Date encoding/decoding in some way.&lt;/p&gt;

&lt;p&gt;This problem is often handled by the layers above the driver, i.e. ODMs like Spring Data and Morphia - these libraries are designed to map different classes into the primitives the Java driver understands.  The best place for a mapping between Rhino types and the Java driver would be a layer that understands the Javascript classes, like &lt;a href=&quot;https://code.google.com/p/mongodb-jvm/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://code.google.com/p/mongodb-jvm/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="480706" author="mykesx" created="Sun, 12 Jan 2014 02:15:21 +0000"  >&lt;p&gt;What I&apos;m looking for is for the Driver to properly serialize org.mozilla.javascript.NativeDate.&lt;/p&gt;

&lt;p&gt;I&apos;d make the following case for supporting it:&lt;/p&gt;

&lt;p&gt;1) Rhino is one of the oldest JavaScript engines around.&lt;br/&gt;
2) It is written in Java&lt;br/&gt;
3) All of the mongodb documentation uses JavaScript shell examples&lt;br/&gt;
4) supporting the proper serialization makes Rhino do #3 perfectly&lt;/p&gt;

&lt;p&gt;The alternative is to complicate life for JavaScript developers who want to use Rhino.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Rhino_(JavaScript_engine&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://en.wikipedia.org/wiki/Rhino_(JavaScript_engine&lt;/a&gt;)&lt;br/&gt;
(Been around since 1998)&lt;/p&gt;

&lt;p&gt;You&apos;re going to have similar issues with the new Nashorn JavaScript engine in Java 8.&lt;/p&gt;</comment>
                            <comment id="478849" author="trisha.gee@10gen.com" created="Wed, 8 Jan 2014 13:03:22 +0000"  >&lt;p&gt;Hi Michael,&lt;/p&gt;

&lt;p&gt;The Java driver is only going to be able to serialise java.util.Date objects, we don&apos;t provide support for serialising any other sort of Date object - it looks like Rhino is creating a org.mozilla.javascript.NativeDate, which the Java driver doesn&apos;t know how to serialise. There&apos;s nothing else on the path that would understand how to convert a Rhino date into a plain Java date.&lt;/p&gt;

&lt;p&gt;I can, however, get this code to work by using java.util.Date instead, by changing the the first few lines to:&lt;/p&gt;

&lt;p&gt;    var MongoClient = Packages.com.mongodb.MongoClient,&lt;br/&gt;
    BasicDBObject = Packages.com.mongodb.BasicDBObject,&lt;br/&gt;
    ObjectId = Packages.org.bson.types.ObjectId,&lt;br/&gt;
    Date = Packages.java.util.Date;&lt;/p&gt;

&lt;p&gt;There are no plans to support any other types of Date serialisation natively in the Java driver, as we can&apos;t add dependencies to other libraries that aren&apos;t needed by the majority of our users, however, if different Date types are required it is possible to create hooks to tell the driver how to encode and decode different types - this is the responsibility of the application using the driver.&lt;/p&gt;

&lt;p&gt;When you say you&apos;re looking for a fix for this issue, are you saying you&apos;d like the driver to support javascript Date types, or are you saying you want a solution that will do the serialisation correctly (i.e. another library)?&lt;/p&gt;</comment>
                            <comment id="476551" author="mykesx" created="Thu, 2 Jan 2014 19:38:43 +0000"  >&lt;p&gt;Thanks Jeff!&lt;/p&gt;

&lt;p&gt;Feel free to contact me if you need me to test anything or provide more information or code.&lt;/p&gt;
</comment>
                            <comment id="476479" author="mykesx" created="Thu, 2 Jan 2014 17:12:19 +0000"  >&lt;p&gt;One more thing I need to point out.  I was mistaken that it was new BasicDBObject() that was failing, it is the collection.insert() call with that BasicDBObject() that is throwing the error.&lt;/p&gt;

&lt;p&gt;Sorry for the confusion.&lt;/p&gt;</comment>
                            <comment id="476478" author="mykesx" created="Thu, 2 Jan 2014 17:10:30 +0000"  >&lt;p&gt;Test program created for you.&lt;/p&gt;

&lt;p&gt;See attached tar.gz file, which contains:&lt;/p&gt;

&lt;p&gt; mschwartz@presto &#57520; ~/src &#57520; tar tzvfp exhibit-bug.tgz&lt;br/&gt;
drwxrwxr-x mschwartz/mschwartz 0 2014-01-02 08:44 mongo/&lt;br/&gt;
&lt;del&gt;rw-r&lt;/del&gt;&lt;del&gt;r&lt;/del&gt;- mschwartz/mschwartz 419054 2014-01-02 08:35 mongo/mongo-java-driver-2.11.3.jar&lt;br/&gt;
&lt;del&gt;rw-rw-r&lt;/del&gt;- mschwartz/mschwartz    528 2014-01-02 09:06 mongo/test.js&lt;br/&gt;
&lt;del&gt;rw-r&lt;/del&gt;&lt;del&gt;r&lt;/del&gt;- mschwartz/mschwartz 1006296 2014-01-02 08:44 mongo/rhino-1.7R5-20130223-1.jar&lt;br/&gt;
-rwxr-xr-x mschwartz/mschwartz     590 2014-01-02 08:44 mongo/testit.sh&lt;/p&gt;

&lt;p&gt;testit.sh is a version of /usr/bin/rhino for Ubuntu that I hacked up a bit to use the 1.7R5 rhino and include mongo driver on the class path:&lt;/p&gt;

&lt;p&gt;mschwartz@presto &#57520; ~/src/mongo &#57520; cat testit.sh&lt;br/&gt;
#!/bin/sh&lt;/p&gt;

&lt;p&gt;JAVA_CMD=&quot;/usr/bin/java&quot;&lt;br/&gt;
JAVA_OPTS=&quot;&quot;&lt;br/&gt;
JAVA_CLASSPATH=&quot;./rhino-1.7R5-20130223-1.jar:./mongo-java-driver-2.11.3.jar&quot;&lt;br/&gt;
JAVA_MAIN=&quot;org.mozilla.javascript.tools.shell.Main&quot;&lt;/p&gt;

&lt;p&gt;##&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
	&lt;ol&gt;
		&lt;li&gt;Remove bootclasspath overriding for OpenJDK since&lt;/li&gt;
		&lt;li&gt;it now use a mangled version of Rhino (in sun.org.mozilla.rhino package)&lt;br/&gt;
##&lt;/li&gt;
		&lt;li&gt;References:&lt;/li&gt;
		&lt;li&gt;&amp;lt;&lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/255149&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/255149&lt;/a&gt;&amp;gt;&lt;/li&gt;
		&lt;li&gt;&amp;lt;&lt;a href=&quot;http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=179&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=179&lt;/a&gt;&amp;gt;&lt;/li&gt;
		&lt;li&gt;&amp;lt;&lt;a href=&quot;http://www.openoffice.org/issues/show_bug.cgi?id=91641&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.openoffice.org/issues/show_bug.cgi?id=91641&lt;/a&gt;&amp;gt;&lt;br/&gt;
##&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;$JAVA_CMD $JAVA_OPTS -classpath $JAVA_CLASSPATH $JAVA_MAIN &quot;$@&quot;&lt;/p&gt;

&lt;p&gt;mschwartz@presto &#57520; ~/src/mongo &#57520; cat test.js&lt;br/&gt;
var MongoClient = Packages.com.mongodb.MongoClient,&lt;br/&gt;
	BasicDBObject = Packages.com.mongodb.BasicDBObject,&lt;br/&gt;
    ObjectId = Packages.org.bson.types.ObjectId;&lt;/p&gt;

&lt;p&gt;var client = new MongoClient(),&lt;br/&gt;
	db = client.getDB(&apos;test&apos;),&lt;br/&gt;
	collection = db.getCollection(&apos;test&apos;);&lt;/p&gt;

&lt;p&gt;var id = new ObjectId();&lt;br/&gt;
var o = {&lt;br/&gt;
    &quot;_id&quot; : id,&lt;br/&gt;
    &quot;when&quot; : new Date(),&lt;br/&gt;
    &quot;name&quot;  : &quot;MongoDB&quot; + &apos;def&apos;,&lt;br/&gt;
    &quot;type&quot;  : &quot;database&quot;,&lt;br/&gt;
    &quot;count&quot; : 1,&lt;br/&gt;
    &quot;info&quot;  : &lt;/p&gt;
{
        x : 203,
        y : 102
    }
&lt;p&gt;};&lt;/p&gt;


&lt;p&gt;var bson = new BasicDBObject(o);&lt;/p&gt;

&lt;p&gt;collection.insert(bson);&lt;/p&gt;

&lt;p&gt;mschwartz@presto &#57520; ~/src/mongo &#57520; ./testit.sh test.js&lt;br/&gt;
org.mozilla.javascript.WrappedException: Wrapped java.lang.IllegalArgumentException: can&apos;t serialize class org.mozilla.javascript.NativeDate&lt;br/&gt;
	at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)&lt;br/&gt;
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)&lt;br/&gt;
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)&lt;br/&gt;
	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)&lt;br/&gt;
	at org.mozilla.javascript.gen.test_js_1._c_script_0(Unknown Source)&lt;br/&gt;
	at org.mozilla.javascript.gen.test_js_1.call(Unknown Source)&lt;br/&gt;
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)&lt;br/&gt;
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3090)&lt;br/&gt;
	at org.mozilla.javascript.gen.test_js_1.call(Unknown Source)&lt;br/&gt;
	at org.mozilla.javascript.gen.test_js_1.exec(Unknown Source)&lt;br/&gt;
	at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:597)&lt;br/&gt;
	at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:556)&lt;br/&gt;
	at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:527)&lt;br/&gt;
	at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:176)&lt;br/&gt;
	at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)&lt;br/&gt;
	at org.mozilla.javascript.Context.call(Context.java:489)&lt;br/&gt;
	at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)&lt;br/&gt;
	at org.mozilla.javascript.tools.shell.Main.exec(Main.java:158)&lt;br/&gt;
	at org.mozilla.javascript.tools.shell.Main.main(Main.java:136)&lt;br/&gt;
Caused by: java.lang.IllegalArgumentException: can&apos;t serialize class org.mozilla.javascript.NativeDate&lt;br/&gt;
	at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:273)&lt;br/&gt;
	at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)&lt;br/&gt;
	at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120)&lt;br/&gt;
	at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)&lt;br/&gt;
	at com.mongodb.OutMessage.putObject(OutMessage.java:289)&lt;br/&gt;
	at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:239)&lt;br/&gt;
	at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:204)&lt;br/&gt;
	at com.mongodb.DBCollection.insert(DBCollection.java:76)&lt;br/&gt;
	at com.mongodb.DBCollection.insert(DBCollection.java:60)&lt;br/&gt;
	at com.mongodb.DBCollection.insert(DBCollection.java:105)&lt;br/&gt;
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;br/&gt;
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)&lt;br/&gt;
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;br/&gt;
	at java.lang.reflect.Method.invoke(Method.java:606)&lt;br/&gt;
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)&lt;br/&gt;
	... 17 more&lt;/p&gt;</comment>
                            <comment id="476454" author="mykesx" created="Thu, 2 Jan 2014 16:29:02 +0000"  >&lt;p&gt;I found the ConsString issue in the 2.11.2 version of the driver.  &lt;/p&gt;

&lt;p&gt;I mentioned the problem in the rhino-users google groups, or to one of the guys working with RingoJS, and was told the ConsString issue is fixed in the latest driver.  Sure enough, the ConsString issue is gone in 2.11.3.&lt;/p&gt;

&lt;p&gt;This project might help:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://code.google.com/p/mongodb-jvm/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://code.google.com/p/mongodb-jvm/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think it has code to serialize the various Rhino classes.  In the mean time, I&apos;ll construct a simple test case for you.&lt;/p&gt;</comment>
                            <comment id="476413" author="jeff.yemin" created="Thu, 2 Jan 2014 14:40:51 +0000"  >&lt;p&gt;Hi Michael, &lt;/p&gt;

&lt;p&gt;We don&apos;t have a lot of experience with users interacting with the driver via Rhino, so it would be helpful if you could provide a standalone Java program that demonstrates the exception.&lt;/p&gt;

&lt;p&gt;Regarding the ConsString, I&apos;m not aware of any change that was made that would effect this.  Exactly which version of the driver did this not work/work in, and are you sure nothing else changed in the environment (like the version of Rhino/Java)?&lt;/p&gt;

</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="35846" name="exhibit-bug.tgz" size="1338252" author="mykesx" created="Thu, 2 Jan 2014 17:11:06 +0000"/>
                    </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|hrgamf:</customfieldvalue>

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