<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:55:55 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>[SERVER-1050] not allowed to $push and $pop to same field in same update</title>
                <link>https://jira.mongodb.org/browse/SERVER-1050</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Was just talking about #991 with Dwight and noticed that you can&apos;t workaround by doing $push / $pop to the same field on the same update, for example:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.test.drop();&lt;br/&gt;
false&lt;br/&gt;
&amp;gt; db.test.save( &lt;/p&gt;
{ mylist: [1,2] }
&lt;p&gt; );&lt;br/&gt;
&amp;gt; db.test.update( {}, { $push: &lt;/p&gt;
{ mylist: 3 }
&lt;p&gt;, $pop: &lt;/p&gt;
{ mylist: -1 }
&lt;p&gt; } );&lt;br/&gt;
Field name duplication not allowed with modifiers&lt;/p&gt;

&lt;p&gt;Would be nice if this was permitted.&lt;/p&gt;</description>
                <environment></environment>
        <key id="11839">SERVER-1050</key>
            <summary>not allowed to $push and $pop to same field in same update</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="backlog-server-query">Backlog - Query Team</assignee>
                                    <reporter username="ibwhite">Ian White</reporter>
                        <labels>
                    </labels>
                <created>Mon, 26 Apr 2010 14:27:19 +0000</created>
                <updated>Tue, 6 Dec 2022 05:49:35 +0000</updated>
                            <resolved>Sat, 29 Jun 2019 07:25:08 +0000</resolved>
                                    <version>1.4.0</version>
                                                    <component>Write Ops</component>
                                        <votes>167</votes>
                                    <watches>117</watches>
                                                                                                                <comments>
                            <comment id="2305988" author="asya" created="Sun, 30 Jun 2019 16:26:43 +0000"  >&lt;p&gt;&amp;gt; Is this still atomic?&lt;/p&gt;

&lt;p&gt;Yes, absolutely, like all updates on a single document, it is all-or-nothing, fully isolated/atomic.&lt;/p&gt;</comment>
                            <comment id="2305797" author="mitar" created="Sat, 29 Jun 2019 19:22:14 +0000"  >&lt;p&gt;Is this still atomic?&lt;/p&gt;</comment>
                            <comment id="2305623" author="asya" created="Sat, 29 Jun 2019 07:25:09 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40381&quot; title=&quot;Add the ability to specify a pipeline to an update command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40381&quot;&gt;&lt;del&gt;SERVER-40381&lt;/del&gt;&lt;/a&gt; implemented support for aggregation expressions to specify update for 4.2.&#160;&lt;/p&gt;

&lt;p&gt;You can see some examples &lt;a href=&quot;https://docs.mongodb.com/master/reference/command/update/index.html#update-command-example-agg&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This can be done by setting the array to its new value using various aggregation array expressions.   I believe this can handle all of the examples/use cases that were mentioned in the comments.&lt;/p&gt;

&lt;p&gt;The more complex &quot;upsert to array&quot; that was mentioned:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.c.update({}, [&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;      {$set:{array:{$cond:{&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            if: {$in:[ &amp;lt;newElement&amp;gt; ,  &quot;$array.x&quot;]},&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            then:{$map:{ ... }} ,   // process array making appropriate change to correct element&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            else: {$concatArrays: [ &quot;$array&quot;, &amp;lt;newElement&amp;gt; ]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;      }}}}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;]);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="1887605" author="asya" created="Wed, 9 May 2018 21:43:21 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=oleg%40evergage.com&quot; class=&quot;user-hover&quot; rel=&quot;oleg@evergage.com&quot;&gt;oleg@evergage.com&lt;/a&gt; you are correct that in 3.6 there are no workarounds for other use cases mentioned here.&lt;/p&gt;

&lt;p&gt;If you are not talking about a sharded cluster, 4.0 will provide a workaround for this (by adding replica set transactions, which allows you to make several updates to the same document in the same transaction and receive ACID guarantees of making a single more complex update) but it won&apos;t be as efficient as making a single update would be.&lt;/p&gt;

&lt;p&gt;We are currently planning work that would resolve this in the following major release, though of course no guarantees since that&apos;s a ways away still.&lt;/p&gt;</comment>
                            <comment id="1887453" author="oleg@evergage.com" created="Wed, 9 May 2018 19:39:52 +0000"  >&lt;p&gt;These are great improvements in 3.6, Asya!&lt;/p&gt;

&lt;p&gt;Unfortunately, we still cannot &quot;upsert&quot; an array element. Right now, it requires logic with an if-element-with-key-present update, falling back to an if-absent update (and then back to present again).&lt;/p&gt;

&lt;p&gt;If I were able to execute &lt;tt&gt;$pull&lt;/tt&gt;&#160;first, then I could remove any existing entries with the key and then re-add using a &lt;tt&gt;$push&lt;/tt&gt;, effectively simulating an upsert.&lt;/p&gt;</comment>
                            <comment id="1887279" author="asya" created="Wed, 9 May 2018 17:32:05 +0000"  >&lt;p&gt;Note that 3.6 added ability to &lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/update/#update-command-arrayfilters&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;update arrays with arrayFilters&lt;/a&gt;&#160;which handles several of the examples described in comments (not all):&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;to add results to multiple items in the array and it seems the best would be to pull off the original entries and then push the items with results added&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&#160;&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; db.coll.update(&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;   {&amp;lt;match-condition&amp;gt;}, &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;   {$set:{&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;array.$[e].newField&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;abc&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;}},&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;   {arrayFilters:[&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;      {e:{otherField:&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;xxx&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;}}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;   ]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; )&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;This will use some match-condition to find documents to update, then update all array elements in &quot;array&quot; that have &quot;otherField&quot; equal to &quot;xxx&quot; by setting &quot;newField&quot; to &quot;abc&quot;.&lt;/p&gt;</comment>
                            <comment id="1411634" author="matt.kalan@10gen.com" created="Tue, 18 Oct 2016 16:22:30 +0000"  >&lt;p&gt;Ran into needing this capability today working with a user.  They want to add results to multiple items in the array and it seems the best would be to pull off the original entries and then push the items with results added&lt;/p&gt;</comment>
                            <comment id="1240927" author="blabergri@amadeus.com" created="Wed, 20 Apr 2016 07:35:31 +0000"  >&lt;p&gt;Quit similar requierment for us : conditional $pull (on sub document field in the array) and non conditional $push in the same update on the same array.&lt;/p&gt;</comment>
                            <comment id="1057324" author="markbigler" created="Sat, 10 Oct 2015 21:15:02 +0000"  >&lt;p&gt;+1&lt;/p&gt;</comment>
                            <comment id="999199" author="ismetozalp" created="Fri, 7 Aug 2015 09:26:39 +0000"  >&lt;p&gt;This type of issues, always requires workarounds, most of the time these workarounds are ending up with ugly solutions.&lt;/p&gt;

&lt;p&gt;Just like this one these are all 5 year issues.&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1243&quot; title=&quot;New operator to update all matching items in an array&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1243&quot;&gt;&lt;del&gt;SERVER-1243&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1920&quot; title=&quot;Sort by collation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1920&quot;&gt;&lt;del&gt;SERVER-1920&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Just like them i am going to watch this issue, hope for someday it will be fixed.&lt;/p&gt;

&lt;p&gt;+1&lt;/p&gt;</comment>
                            <comment id="967602" author="rwander" created="Thu, 16 Jul 2015 10:44:11 +0000"  >&lt;p&gt;+1&lt;/p&gt;</comment>
                            <comment id="845513" author="brg2" created="Sat, 7 Mar 2015 05:21:32 +0000"  >&lt;p&gt;This would be very helpful when trying to move sub objects from one array to another. &lt;/p&gt;</comment>
                            <comment id="713990" author="reneseses" created="Mon, 8 Sep 2014 20:20:58 +0000"  >&lt;p&gt;+1&lt;/p&gt;</comment>
                            <comment id="699611" author="mamoulian" created="Fri, 22 Aug 2014 11:04:45 +0000"  >&lt;p&gt;Also related to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2643&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-2643&lt;/a&gt; I think&lt;/p&gt;</comment>
                            <comment id="614334" author="esroberts" created="Mon, 9 Jun 2014 18:50:42 +0000"  >&lt;p&gt;Similar scenario as Kevin Rice.  I need to upsert a variable amount of values into arrays but pad to a default max in a single call.&lt;/p&gt;</comment>
                            <comment id="586724" author="boutell" created="Fri, 16 May 2014 19:12:54 +0000"  >&lt;p&gt;+1. Just hit this in the same scenario as Michael Dwan. When propagating permissions changes it makes sense to remove some and add some at the same time, and it&apos;s not a good idea to have competing threads doing it.&lt;/p&gt;</comment>
                            <comment id="499049" author="justanyone" created="Fri, 14 Feb 2014 00:07:56 +0000"  >&lt;p&gt;I&apos;m using an array to do padding for me.  I want to start out with &apos;offsets&apos; as an array of 100 elems, then pop off it each time I insert in &apos;vals&apos;.  this is fine, normally, I push vals and pop offsets.  But, I want to do an upsert, and it apparently won&apos;t let me do setOnInsert of (offsets = array of 100 elems) AND pop from offsets (the normal case): &lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;retval = self.colname.update(&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    { &apos;xx&apos; : &apos;aa&apos; },&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    { &apos;$push&apos; : {&apos;vals&apos; : datapoint}, &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;       &apos;$pop&apos;  : {&apos;offsets&apos; : 1},&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;       &apos;$setOnInsert&apos; : { &apos;offsets&apos; : offsets },&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;     }, upsert = True, multi = False, w = writeConcern )&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I get the error:&lt;/p&gt;

&lt;p&gt;OperationFailure: Field name duplication not allowed with modifiers&lt;/p&gt;</comment>
                            <comment id="495415" author="robertwhurst" created="Fri, 7 Feb 2014 19:26:52 +0000"  >&lt;p&gt;&lt;b&gt;bump&lt;/b&gt;&lt;/p&gt;</comment>
                            <comment id="463188" author="robertwhurst" created="Thu, 28 Nov 2013 19:23:56 +0000"  >&lt;p&gt;This is a rather important issue. Is there any progress on this issue thus far? I&apos;d like to remove the ugly hack we have in our orm to split diffs with both $pullAll and $push.&lt;/p&gt;</comment>
                            <comment id="142068" author="debarshim" created="Wed, 11 Jul 2012 20:33:48 +0000"  >&lt;p&gt;My vote is there for this. This would be really useful to have. Trying to implement a kind of versioning strategy for mongo documents and though there may be other ways to bypass this current limitation, the end solution won&apos;t unfortunately be so tight.&lt;/p&gt;</comment>
                            <comment id="103456" author="pheinze" created="Mon, 26 Mar 2012 08:35:38 +0000"  >&lt;p&gt;Kekoa Vincent,&lt;/p&gt;

&lt;p&gt;you may avoid the race Condition if you make the updates atomic by adding a temporary lock with the first update which is then removed with the second, so no two Threads may perform this operation for one document at the same time. Though you need some error handling for that in your app. Anyway this ticket needs to be resolved.&lt;/p&gt;</comment>
                            <comment id="97264" author="kekoav" created="Fri, 9 Mar 2012 18:12:31 +0000"  >&lt;p&gt;Also agree that a general solution for this is needed, my use case is I need to refresh items in a list, so I $pull the items out of the list and $pushAll the new version of the items, leaving existing items that aren&apos;t being updated there unmodified.  It would be great if this were atomic so there wouldn&apos;t be a race condition with other threads or processes doing the same thing and resulting in duplicates.&lt;/p&gt;

&lt;p&gt;Order of operations does matter in this situation, so please consider that in the implementation.  My workaround is to perform two updates, and cross my fingers that I don&apos;t have two threads running the updates on the same document.&lt;/p&gt;</comment>
                            <comment id="95515" author="slg1013" created="Mon, 5 Mar 2012 21:04:03 +0000"  >&lt;p&gt;I agree with Jon D and also need the ability to $pull and $push from the same array in a single operation.&lt;/p&gt;</comment>
                            <comment id="76454" author="andy.gayton" created="Thu, 29 Dec 2011 01:17:59 +0000"  >&lt;p&gt;For sure Scott, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-991&quot; title=&quot;$push with $slice + $sort&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-991&quot;&gt;&lt;del&gt;SERVER-991&lt;/del&gt;&lt;/a&gt; would be ideal, if possible.&lt;/p&gt;</comment>
                            <comment id="76450" author="scotthernandez" created="Thu, 29 Dec 2011 00:21:34 +0000"  >&lt;p&gt;Andy, I&apos;ve linked to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-991&quot; title=&quot;$push with $slice + $sort&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-991&quot;&gt;&lt;del&gt;SERVER-991&lt;/del&gt;&lt;/a&gt; which is probably more what you want &amp;#8211; a fixed size $push.&lt;/p&gt;</comment>
                            <comment id="76448" author="andy.gayton" created="Thu, 29 Dec 2011 00:16:26 +0000"  >&lt;p&gt;Our use case is we keep versioned data as a list sub-document.  Each time the data is changed the new version of the data is $push-ed on to the head of the list.  To keep this list bounded, when the list reaches 60 versions, we $push the newest on to the head, and $pull the oldest 10 versions.  This keeps the number of versions stable between 50-60.  It&apos;d be nice for this operation to be atomic.&lt;/p&gt;</comment>
                            <comment id="60019" author="redth" created="Wed, 12 Oct 2011 12:57:43 +0000"  >&lt;p&gt;I&apos;d request that the ability to $pull and then $push in the same update operation be included as well.  I have a scenario where I&apos;m storing somewhat complex sub-documents inside an array where I want to $pull first on a query including equality and $lte operators (if any matching records exist), and then push a new version of the sub-document to the same array.  Currently I need to issue two updates to accomplish this.  This is a very common query in my system and will be issued millions of times daily, so this would be a nice little boost for me!&lt;/p&gt;

&lt;p&gt;eg: { { $pull : { &quot;a&quot; : 2, { $lte : &lt;/p&gt;
{ &quot;updated&quot; : &apos;2011-01-01&apos; }
&lt;p&gt; } } }, { $push : &lt;/p&gt;
{ &quot;a&quot; : 2, &quot;b&quot; : 3, &quot;updated&quot; : &apos;2011-01-02&apos; }
&lt;p&gt; } }&lt;/p&gt;</comment>
                            <comment id="33894" author="harald" created="Mon, 23 May 2011 09:27:00 +0000"  >&lt;p&gt;I think this should not only be limited to $push and $pop but to other atomic operations, too. For example: {$inc: &lt;/p&gt;
{&apos;test&apos;: 0}
&lt;p&gt;, $set: {&apos;test&apos;: 50}}. While at first sight this might not make much sense, there is on the other hand no reason, why this should not work. I am doing some dynamic update operations on some collection, where the update object is built dynamically. I use &quot;&apos;$inc&apos;: 0&quot; to have the possibility to initialize some object, if it has no value and leave it&apos;s value, if it&apos;s already there. The &quot;$set&quot; operation is added dynamically from the application (sometimes it&apos;s there, sometimes not), if required. I do not have to build complex logic structures in my script.&lt;/p&gt;

&lt;p&gt;On the other hand: The database needs to now in which order the operation need to be performed. For example:&lt;/p&gt;

&lt;p&gt;{&apos;$inc&apos;: &lt;/p&gt;
{&apos;test&apos;: 1}
&lt;p&gt;, &apos;$set&apos;: {&apos;test&apos;: 50}}    and    {&apos;$set&apos;: &lt;/p&gt;
{&apos;test&apos;: 50}
&lt;p&gt;, &apos;$inc&apos;: {&apos;test&apos;: 1}}&lt;/p&gt;

&lt;p&gt;are totally different operations.&lt;/p&gt;</comment>
                            <comment id="32971" author="michaeldwan" created="Mon, 16 May 2011 19:57:40 +0000"  >&lt;p&gt;+1 &amp;#8211; We&apos;re trying to add and remove values from a permissions array field in a single query, however until this is resolved it requires 2 queries.&lt;/p&gt;</comment>
                            <comment id="29118" author="cly" created="Sat, 16 Apr 2011 17:29:43 +0000"  >&lt;p&gt;If this issue is resolved will it cover the use case from &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2362&quot; title=&quot;Add new Deque/Set operation modifiers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2362&quot;&gt;&lt;del&gt;SERVER-2362&lt;/del&gt;&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;Essentially, will it allow $pull and then $push in the same atomic operation to allow some sort of ordered set functionality where the array entries are distinct and ordered by last insertion as opposed to $addToSet where the entries are distinct but is ordered by initial insertion?&lt;/p&gt;</comment>
                            <comment id="29113" author="musa" created="Sat, 16 Apr 2011 00:03:48 +0000"  >&lt;p&gt;This is a basic array operation same as array&lt;span class=&quot;error&quot;&gt;&amp;#91;idx&amp;#93;&lt;/span&gt;=&quot;new value&quot;. &lt;/p&gt;

&lt;p&gt;Why do we need to $pull and $addToSet?&lt;/p&gt;

&lt;p&gt;It would be nice if we could use $elemMatch and then replace the value.&lt;/p&gt;</comment>
                            <comment id="27704" author="leif" created="Mon, 4 Apr 2011 16:58:35 +0000"  >&lt;p&gt;We ran into the need for this as well.  I am able to work around it with multiple queries.  But this will not be safe for some updates.&lt;/p&gt;</comment>
                            <comment id="27156" author="charso" created="Tue, 29 Mar 2011 19:37:15 +0000"  >&lt;p&gt;Has my vote.&lt;/p&gt;</comment>
                            <comment id="21267" author="drapeko" created="Thu, 9 Dec 2010 22:34:49 +0000"  >&lt;p&gt;Yeap, we definetely need this atomic operation&lt;/p&gt;</comment>
                            <comment id="16958" author="phpmoadmin" created="Mon, 16 Aug 2010 21:33:43 +0000"  >&lt;p&gt;Having the same issue, I am trying to get stack-behavior via:&lt;br/&gt;
db.col.update( &lt;/p&gt;
{...}
&lt;p&gt;, { $push: { stack: &lt;/p&gt;
{...val..}
&lt;p&gt; }, $pop: &lt;/p&gt;
{ stack: -1 }
&lt;p&gt; } );&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="332607">SERVER-27089</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="11744">SERVER-991</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="45148">SERVER-6566</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="14224">SERVER-2362</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="14934">SERVER-2643</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="13377">SERVER-1947</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>35.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25143"><![CDATA[Query]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 16 Aug 2010 21:33:43 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 32 weeks, 3 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-27089'>SERVER-27089</a></s>]]></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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1021</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 32 weeks, 3 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andy.gayton</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-query</customfieldvalue>
            <customfieldvalue>blabergri@amadeus.com</customfieldvalue>
            <customfieldvalue>brg2</customfieldvalue>
            <customfieldvalue>cly</customfieldvalue>
            <customfieldvalue>charso</customfieldvalue>
            <customfieldvalue>debarshim</customfieldvalue>
            <customfieldvalue>drapeko</customfieldvalue>
            <customfieldvalue>esroberts</customfieldvalue>
            <customfieldvalue>harald</customfieldvalue>
            <customfieldvalue>ibwhite</customfieldvalue>
            <customfieldvalue>ismetozalp</customfieldvalue>
            <customfieldvalue>redth</customfieldvalue>
            <customfieldvalue>kekoav</customfieldvalue>
            <customfieldvalue>justanyone</customfieldvalue>
            <customfieldvalue>leif</customfieldvalue>
            <customfieldvalue>markbigler</customfieldvalue>
            <customfieldvalue>matt.kalan@mongodb.com</customfieldvalue>
            <customfieldvalue>michaeldwan</customfieldvalue>
            <customfieldvalue>musa</customfieldvalue>
            <customfieldvalue>mamoulian</customfieldvalue>
            <customfieldvalue>mitar</customfieldvalue>
            <customfieldvalue>oleg@evergage.com</customfieldvalue>
            <customfieldvalue>pheinze</customfieldvalue>
            <customfieldvalue>phpmoadmin</customfieldvalue>
            <customfieldvalue>reneseses</customfieldvalue>
            <customfieldvalue>RobertWHurst</customfieldvalue>
            <customfieldvalue>rwander</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
            <customfieldvalue>slg1013</customfieldvalue>
            <customfieldvalue>boutell</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpn6v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr747z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4965</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrhx9z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>