<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:19 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>[CSHARP-263] Deserialization of array that was serialized with nominalType object fails due to lack of type information</title>
                <link>https://jira.mongodb.org/browse/CSHARP-263</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Can reproduce using this class:&lt;/p&gt;

&lt;p&gt;    public class C &lt;/p&gt;
{
        public ObjectId Id;
        public object Obj;
    }

&lt;p&gt;and this code:&lt;/p&gt;

&lt;p&gt;    collection.RemoveAll();&lt;br/&gt;
    var c = new C { Obj = new int[] &lt;/p&gt;
{ 1, 2, 3 }
&lt;p&gt; };&lt;br/&gt;
    collection.Insert(c);&lt;/p&gt;

&lt;p&gt;    var r = collection.FindOneAs&amp;lt;C&amp;gt;(); // fails&lt;/p&gt;</description>
                <environment></environment>
        <key id="19225">CSHARP-263</key>
            <summary>Deserialization of array that was serialized with nominalType object fails due to lack of type information</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="robert@mongodb.com">Robert Stam</reporter>
                        <labels>
                    </labels>
                <created>Thu, 7 Jul 2011 13:53:37 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:36 +0000</updated>
                            <resolved>Tue, 9 Aug 2011 14:22:15 +0000</resolved>
                                    <version>1.1</version>
                                    <fixVersion>1.2</fixVersion>
                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="47348" author="rstam" created="Tue, 9 Aug 2011 14:22:03 +0000"  >&lt;p&gt;Created a new issue &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-301&quot; title=&quot;Deserialization of Dictionary that was serialized with nominalType object fails due to lack of type information&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-301&quot;&gt;&lt;del&gt;CSHARP-301&lt;/del&gt;&lt;/a&gt; for Dictionary so that this issue can be closed for arrays.&lt;/p&gt;</comment>
                            <comment id="41323" author="rstam" created="Fri, 8 Jul 2011 14:14:49 +0000"  >&lt;p&gt;Running the above code results in the following document being inserted into the database:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.test.find()&lt;/p&gt;
{ &quot;_id&quot; : ObjectId(&quot;4e170e44e447ad78a009cf75&quot;), &quot;Obj&quot; : [ 1, 2, 3 ] }
&lt;p&gt;&amp;gt;&lt;/p&gt;

&lt;p&gt;The question is, what could this be serialized as? Perhaps:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.test.find()&lt;br/&gt;
{ &quot;_id&quot; : ObjectId(&quot;4e170e44e447ad78a009cf75&quot;), &quot;Obj&quot; : &lt;/p&gt;
{ &quot;_t&quot; : &quot;System.Int32[]&quot;, &quot;_v&quot; : [ 1, 2, 3 ] }
&lt;p&gt; }&lt;br/&gt;
&amp;gt;&lt;/p&gt;

&lt;p&gt;Not very cross platform... (includes .NET type name).&lt;/p&gt;

&lt;p&gt;A very similar problem occurs with Dictionaries:&lt;/p&gt;

&lt;p&gt;    var c = new C { Obj = new Dictionary&amp;lt;string, int&amp;gt; { &lt;/p&gt;
{ &quot;a&quot;, 1 }
&lt;p&gt;, &lt;/p&gt;
{ &quot;b&quot;, 2 }
&lt;p&gt;, &lt;/p&gt;
{ &quot;c&quot;, 3 }
&lt;p&gt; } };&lt;br/&gt;
    collection.Insert(c);&lt;/p&gt;

&lt;p&gt;which serializes as:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.test.find()&lt;br/&gt;
{ &quot;_id&quot; : ObjectId(&quot;4e171014e447adbd34b71987&quot;), &quot;Obj&quot; : &lt;/p&gt;
{ &quot;a&quot; : 1, &quot;b&quot; : 2, &quot;c&quot; : 3 }
&lt;p&gt; }&lt;br/&gt;
&amp;gt;&lt;/p&gt;

&lt;p&gt;And also can&apos;t be deserialized due to the lack of type information.&lt;/p&gt;

&lt;p&gt;Another question is whether you should get back an instance of the exact same type as you started with. If not, these two examples could simply be deserialized as a BsonArray and a BsonDocument, but that&apos;s different than what you started with (an Int32[] and a Dictionary&amp;lt;string, int&amp;gt;).&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="20745">CSHARP-301</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="35345">CSHARP-429</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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|hrh8qf:</customfieldvalue>

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