<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:59:18 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-3316] Unable to Parse Date String in Json String using Document.parse()</title>
                <link>https://jira.mongodb.org/browse/JAVA-3316</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Code:&lt;/p&gt;

&lt;p&gt; &lt;b&gt;static String dateStr = &quot;{ \&quot;name\&quot; : \&quot;Bruce Lee\&quot;, \&quot;age\&quot; : 100, \&quot;LossDate\&quot;:{\&quot;$date\&quot;:&apos;1970-01-01&apos;}}&quot;;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Document doc = Document.parse(dateStr);&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;org.bson.json.JsonParseException: Failed to parse string as a date&lt;br/&gt;
 at org.bson.json.JsonReader.visitDateTimeExtendedJson(JsonReader.java:1057)&lt;br/&gt;
 at org.bson.json.JsonReader.visitExtendedJSON(JsonReader.java:618)&lt;br/&gt;
 at org.bson.json.JsonReader.readBsonType(JsonReader.java:148)&lt;br/&gt;
 at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:149)&lt;br/&gt;
 at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)&lt;/p&gt;</description>
                <environment>Windows 10</environment>
        <key id="796529">JAVA-3316</key>
            <summary>Unable to Parse Date String in Json String using Document.parse()</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="schen@amica.com">shen Chen</reporter>
                        <labels>
                    </labels>
                <created>Tue, 11 Jun 2019 14:15:41 +0000</created>
                <updated>Wed, 30 Mar 2022 22:59:30 +0000</updated>
                                                                            <component>JSON</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2477330" author="jeff.yemin" created="Fri, 11 Oct 2019 00:15:41 +0000"  >&lt;p&gt;If we did something I would want to do it as a &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/extended-json.rst&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;specification&lt;/a&gt; change so that all drivers accepted the same formats.&lt;/p&gt;</comment>
                            <comment id="2296476" author="schen@amica.com" created="Tue, 25 Jun 2019 13:54:03 +0000"  >&lt;p&gt;HI Ross,&lt;/p&gt;

&lt;p&gt;Thank you for the info. Looks like I either need to create custom JsonReader or pass in the date string in the accepted Java Date Format Pattern String: yyyy-MM-dd&apos;T&apos;HH:mm:ss.SSSXXX or yyyy-MM-dd&apos;T&apos;HH:mm:ss.SSS&apos;Z&apos; or just simply a long number.&lt;/p&gt;</comment>
                            <comment id="2296214" author="ross@10gen.com" created="Tue, 25 Jun 2019 09:23:54 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=shen915&quot; class=&quot;user-hover&quot; rel=&quot;shen915&quot;&gt;shen915&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Currently, there is no easy way to add custom parsers to the JsonReader.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="2295560" author="schen@amica.com" created="Mon, 24 Jun 2019 19:54:11 +0000"  >&lt;p&gt;Hi Ross,&lt;/p&gt;

&lt;p&gt;Is there a way allow me to inject my own date parser into the Document.parse method? Thank you for the response.&lt;/p&gt;</comment>
                            <comment id="2294945" author="ross@10gen.com" created="Mon, 24 Jun 2019 15:54:25 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=shen915&quot; class=&quot;user-hover&quot; rel=&quot;shen915&quot;&gt;shen915&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The driver json &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/extended-json.rst#id21&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;specification&lt;/a&gt; only supports iso date times and not iso dates. This is because there is no corresponding BSON type that represents just a date.&lt;/p&gt;

&lt;p&gt;I hope that helps clarify the reasons why the example fails.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="2279460" author="schen@amica.com" created="Tue, 11 Jun 2019 14:19:32 +0000"  >&lt;p&gt;MongoDB Java Driver 3.4.1. Also tested using newer version of MongoDB Java Driver.&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|huu47j:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>