<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:38:11 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-2260] UpdateMany doesn&apos;t support links to existing fields</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2260</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;



&lt;p&gt;&lt;tt&gt;Go driver&apos;s UpdateMany doesn&apos;t update fields using existing fields in object.&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;col.UpdateMany(ctx,bson.M{&#8220;id&#8221;:123},bson.D{&quot;$set&quot;, bson.D{&#8220;PreviousRecord&#8221;,&quot;$CurrentRecord&quot;&lt;/tt&gt;)}}&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;This command will update object:&lt;/tt&gt;&lt;br/&gt;
{{&lt;/p&gt;
{ id:123, PreviousRecord:&quot;old&quot;, CurrentRecord:&quot;new&quot; }
&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;as:&lt;/tt&gt;&lt;br/&gt;
{{&lt;/p&gt;
{ id:123, PreviousRecord:&quot;$CurrentRecord&quot;, CurrentRecord:&quot;new&quot; }
&lt;p&gt;}}&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;MongoDB4.4%28dockerimagemongo%3A4.4%29%3BGOdriver1.7.1&quot;&gt;&lt;/a&gt;MongoDB 4.4 (docker image mongo:4.4); GO-driver 1.7.1&lt;/h4&gt;

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

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1956696">GODRIVER-2260</key>
            <summary>UpdateMany doesn&apos;t support links to existing fields</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="13203">Gone away</resolution>
                                        <assignee username="benji.rewis@mongodb.com">Benji Rewis</assignee>
                                    <reporter username="slavik-undead@mail.ru">Apocalypsy .</reporter>
                        <labels>
                    </labels>
                <created>Tue, 28 Dec 2021 18:38:01 +0000</created>
                <updated>Fri, 27 Oct 2023 20:01:13 +0000</updated>
                            <resolved>Thu, 20 Jan 2022 12:00:36 +0000</resolved>
                                                                    <component>Core API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4302514" author="dbeng-pm-bot" created="Thu, 20 Jan 2022 12:00:37 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="4276823" author="benji.rewis" created="Wed, 5 Jan 2022 18:35:20 +0000"  >&lt;p&gt;Hello again, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=slavik-undead%40mail.ru&quot; class=&quot;user-hover&quot; rel=&quot;slavik-undead@mail.ru&quot;&gt;slavik-undead@mail.ru&lt;/a&gt;. As of MongoDB 4.4, update functions (such as the &lt;tt&gt;UpdateMany&lt;/tt&gt; you&apos;re using), &lt;a href=&quot;https://docs.mongodb.com/manual/tutorial/update-documents-with-aggregation-pipeline/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;can now be used&lt;/a&gt; with aggregation pipelines and their associated stages. To use &lt;tt&gt;$set&lt;/tt&gt; with &lt;tt&gt;UpdateMany&lt;/tt&gt; as you&apos;ve done above, you&apos;ll have to make sure the &quot;update&quot; parameter to &lt;tt&gt;UpdateMany&lt;/tt&gt; is actually an aggregation pipeline. In other words, the &quot;update&quot; parameter must be an array not a single document. You should get the behavior you&apos;re looking for if you encase the &lt;tt&gt;bson.D&lt;/tt&gt; containing the &lt;tt&gt;$set&lt;/tt&gt; with a &lt;tt&gt;bson.A&lt;/tt&gt;. I&apos;ve attached an example of how that might look given your example code. Let me know if that works!&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/attachment/353455/353455_setfieldinupdate.go&quot; title=&quot;setfieldinupdate.go attached to GODRIVER-2260&quot;&gt;setfieldinupdate.go&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</comment>
                            <comment id="4275108" author="benji.rewis" created="Tue, 4 Jan 2022 21:53:06 +0000"  >&lt;p&gt;Thanks for your bug report, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=slavik-undead%40mail.ru&quot; class=&quot;user-hover&quot; rel=&quot;slavik-undead@mail.ru&quot;&gt;slavik-undead@mail.ru&lt;/a&gt;! We&apos;re taking a look now.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="353455" name="setfieldinupdate.go" size="1060" author="benji.rewis@mongodb.com" created="Wed, 5 Jan 2022 18:35:42 +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|hzytbj:</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>