<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35:05 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>[GODRIVER-842] bson can&apos;t marshal an interface </title>
                <link>https://jira.mongodb.org/browse/GODRIVER-842</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;I have an interface, let&apos;s say:&lt;/p&gt;

&lt;p&gt;&#160;&lt;br/&gt;
&lt;b&gt;type ITest interface {&lt;/b&gt;&lt;br/&gt;
&#160;&#160;&#160;&#160;&lt;b&gt;Hello()&lt;/b&gt;&lt;br/&gt;
&lt;b&gt;}&lt;/b&gt;&lt;br/&gt;
&#160;&lt;br/&gt;
Struct, which implements this:&lt;/p&gt;



&lt;p&gt;&lt;b&gt;type STest struct {&lt;/b&gt;&lt;br/&gt;
&#160;&#160;&#160;&#160;&lt;b&gt;Greeting string&lt;/b&gt;&lt;br/&gt;
&lt;b&gt;}&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;func (s *STest) Hello() {&lt;/b&gt;&lt;br/&gt;
&#160;&#160;&#160;&#160;&lt;b&gt;fmt.Println(s.Greeting)&lt;/b&gt;&lt;br/&gt;
&lt;b&gt;}&lt;/b&gt;&lt;br/&gt;
And an array of &lt;b&gt;ITest&lt;/b&gt; interfaces with a&#160;&lt;b&gt;STest&lt;/b&gt; struct as first element:&lt;br/&gt;
&#160;&lt;br/&gt;
&lt;b&gt;var iArr []ITest&lt;/b&gt;&lt;br/&gt;
&lt;b&gt;iArr = append(iArr, &amp;amp;STest{&quot;heelloo&quot;})&lt;/b&gt;&lt;br/&gt;
&#160;&lt;br/&gt;
When i&apos;m trying to create an update document for UpdateOne method, i do the following:&lt;br/&gt;
&#160;&lt;br/&gt;
&lt;b&gt;bson.D{{&quot;$set&quot;, bson.D{{&quot;somefield&quot;, iArr}}}}&lt;/b&gt;&lt;br/&gt;
&#160;&lt;br/&gt;
and getting an error:&lt;br/&gt;
&#160;&lt;br/&gt;
&lt;em&gt;cannot transform type primitive.D to a BSON Document: no encoder found for models.ITest&lt;/em&gt;&lt;br/&gt;
&#160;&lt;br/&gt;
But for the separate element it works like a charm (no error, present in db):&lt;br/&gt;
&#160;&lt;br/&gt;
&lt;b&gt;bson.D{{&quot;$set&quot;, bson.D{{&quot;somefield&quot;, iArr&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;}}}}&lt;/b&gt;&lt;br/&gt;
&#160;&lt;br/&gt;
&#160;&lt;br/&gt;
So is it bug or something?&lt;/p&gt;

&lt;p&gt;PS: i&apos;m using&#160;&lt;b&gt;v1.0.0-rc1+prerelease&lt;/b&gt; version&lt;/p&gt;</description>
                <environment></environment>
        <key id="701825">GODRIVER-842</key>
            <summary>bson can&apos;t marshal an interface </summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="-1">Unassigned</assignee>
                                    <reporter username="ollevche">ollevche</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Feb 2019 09:18:03 +0000</created>
                <updated>Wed, 11 Sep 2019 18:35:36 +0000</updated>
                            <resolved>Mon, 4 Mar 2019 21:30:28 +0000</resolved>
                                    <version>1.0.0</version>
                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2317843" author="manny.eppinger" created="Tue, 9 Jul 2019 20:24:14 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1117&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/GODRIVER-1117&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2252784" author="ollevche" created="Mon, 20 May 2019 15:49:15 +0000"  >&lt;p&gt;How can i do this? Can&apos;t find any doc&lt;br/&gt;
thx in advance&lt;/p&gt;</comment>
                            <comment id="2170074" author="ian@10gen.com" created="Mon, 4 Mar 2019 21:30:28 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ollevche&quot; class=&quot;user-hover&quot; rel=&quot;ollevche&quot;&gt;ollevche&lt;/a&gt;, you&apos;ll have to register a custom codec if you&apos;d like to do this.&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|hue0pz:</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>