<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:22 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-281] PopFirst and PopLast do the opposite jobs</title>
                <link>https://jira.mongodb.org/browse/CSHARP-281</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Here is the PowerShell script that shows the bug:&lt;br/&gt;
(on the other hand, it is not even needed, just double check the driver code of these methods)&lt;/p&gt;


&lt;p&gt;	Add-Type -Path MongoDB.Driver.dll&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;DOCS: &lt;a href=&quot;http://www.mongodb.org/display/DOCS/Updating&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Updating&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;Output: 
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { &amp;quot;$pop&amp;quot; }&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;Expected, see DOCS: 
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { $pop }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;	$PopFirst = &lt;span class=&quot;error&quot;&gt;&amp;#91;MongoDB.Driver.Builders.Update&amp;#93;&lt;/span&gt;::PopFirst(&quot;name&quot;)&lt;br/&gt;
	$PopFirst.ToString()&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;Output: 
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { &amp;quot;$pop&amp;quot; }&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;Expected, see DOCS: 
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { $pop }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;	$PopLast = &lt;span class=&quot;error&quot;&gt;&amp;#91;MongoDB.Driver.Builders.Update&amp;#93;&lt;/span&gt;::PopLast(&quot;name&quot;)&lt;br/&gt;
	$PopLast.ToString()&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Note: I have also tried some real example but the code is not so easy to share. Yes, these function do the opposite job, as if their bodies are swapped by mistake.&lt;/p&gt;</description>
                <environment></environment>
        <key id="20098">CSHARP-281</key>
            <summary>PopFirst and PopLast do the opposite jobs</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="nightroman">Roman Kuzmin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 25 Jul 2011 18:17:04 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:13 +0000</updated>
                            <resolved>Tue, 26 Jul 2011 14:35:27 +0000</resolved>
                                    <version>1.1</version>
                                    <fixVersion>1.2</fixVersion>
                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="44522" author="rstam" created="Tue, 26 Jul 2011 14:35:27 +0000"  >&lt;p&gt;The implementations PopFirst and PopLast were reversed. If you compensated for this by using the opposite method then this fix will break your code.&lt;/p&gt;</comment>
                            <comment id="44520" author="rstam" created="Tue, 26 Jul 2011 14:34:29 +0000"  >&lt;p&gt;If you ever need to write code that does different things depending on which version of the driver it is using, you can discover the version of the driver at runtime using:&lt;/p&gt;

&lt;p&gt;    var assembly = typeof(MongoServer).Assembly;&lt;br/&gt;
    var version = assembly.GetName().Version;&lt;/p&gt;

&lt;p&gt;In this particular case, if you want your code to work before and after this fix you could avoid using Update.PopFirst and Update.PopLast and just build the update modifier directly:&lt;/p&gt;

&lt;p&gt;    var update = new UpdateDocument(&quot;$pop&quot;, new BsonDocument(&quot;x&quot;, -1)); // instead of PopFirst&lt;/p&gt;</comment>
                            <comment id="44352" author="nightroman" created="Mon, 25 Jul 2011 19:09:31 +0000"  >&lt;p&gt;Yes, the fix will break the workaround. It will be more difficult to watch both official 1.1 and the latest version built from sources.&lt;br/&gt;
Such is life &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="44351" author="rstam" created="Mon, 25 Jul 2011 18:59:17 +0000"  >&lt;p&gt;This is going to be a backward breaking fix. If you compensated for this bug by calling the opposite function you will be affected when they start doing what they are supposed to be doing.&lt;/p&gt;</comment>
                            <comment id="44350" author="rstam" created="Mon, 25 Jul 2011 18:57:06 +0000"  >&lt;p&gt;That&apos;s definitely a mistake. Thanks for reporting this.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10012"><![CDATA[Major Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hrgv7r:</customfieldvalue>

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