<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:58:03 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-1786] $or paired with upsert does not create documents for each or clause</title>
                <link>https://jira.mongodb.org/browse/SERVER-1786</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When multiple keys are put together with an $or expression and the upsert flag is sent to update (and the multi flag is set) objects are not created for the items in the $or expression.  &lt;/p&gt;

&lt;p&gt;This code using pymongo:&lt;/p&gt;

&lt;p&gt;    keys = []&lt;br/&gt;
    for item in items:&lt;br/&gt;
        key = &lt;/p&gt;
{
            &apos;a : item.a,
            &apos;b&apos; : item.b,
            &apos;c&apos; : item.c
        }
&lt;p&gt;        keys.append(key)&lt;/p&gt;

&lt;p&gt;    if len(keys) == 0:&lt;br/&gt;
        return&lt;/p&gt;

&lt;p&gt;    query = &lt;/p&gt;
{
        &apos;$or&apos; : keys
    }

&lt;p&gt;    value = {&lt;br/&gt;
        &apos;$inc&apos; : &lt;/p&gt;
{
            &apos;count&apos; : 1
        }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    db.abc_counts.update(query, value, upsert=True, multi=True)&lt;/p&gt;

&lt;p&gt;Produces this in the DB:&lt;/p&gt;

{ &quot;_id&quot; : ObjectId(&quot;4c8e7161010f681721439e58&quot;), &quot;count&quot; : 1 }

&lt;p&gt;if i replace query with keys&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; it works as expected.&lt;/p&gt;</description>
                <environment>mongodb 1.6.2, pymongo-1.8.1, python 2.6</environment>
        <key id="13082">SERVER-1786</key>
            <summary>$or paired with upsert does not create documents for each or clause</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="backlog-server-query">Backlog - Query Team</assignee>
                                    <reporter username="jeff">jeff jenkins</reporter>
                        <labels>
                    </labels>
                <created>Mon, 13 Sep 2010 19:00:05 +0000</created>
                <updated>Tue, 6 Dec 2022 05:48:09 +0000</updated>
                            <resolved>Fri, 11 Aug 2017 18:52:46 +0000</resolved>
                                    <version>1.6.2</version>
                                                    <component>Write Ops</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="22406" author="eliot" created="Sun, 16 Jan 2011 06:23:08 +0000"  >&lt;p&gt;unclear if that&apos;s the right semantics or not&lt;/p&gt;</comment>
                            <comment id="18150" author="jeff" created="Tue, 14 Sep 2010 14:13:37 +0000"  >&lt;p&gt;No, I was expecting each item in $or to be a new object with count:1, or to have count:n if it already existed.  The use-case is that I&apos;ve got 10s of objects which have a count associated with them which I would like to increment.  It could be that this doesn&apos;t make sense when the $or expressions aren&apos;t uniform like mine are, but I couldn&apos;t find any other way to do a bulk upsert in pymongo.  If it isn&apos;t something I can do, upsert and $or should probably be mutually exclusive and raise an exception.&lt;/p&gt;

&lt;p&gt;I was expecting:&lt;/p&gt;

{ count: 1, a: &apos;someA&apos;, b:&apos;someB&apos;, c:&apos;someC&apos;, _id:ObjectId(&apos;23423423&apos;) }
{ count: 1, a: &apos;anotherA&apos;, b:&apos;anotherB&apos;, c:&apos;anotherC&apos;, _id:ObjectId(&apos;23423423&apos;) }
&lt;p&gt;etc&lt;/p&gt;</comment>
                            <comment id="18127" author="scotthernandez" created="Mon, 13 Sep 2010 21:31:13 +0000"  >&lt;p&gt;Jeff,&lt;/p&gt;

&lt;p&gt;So you expect &lt;b&gt;all&lt;/b&gt; the of &quot;or&quot; conditions to be combined into an array?&lt;/p&gt;

&lt;p&gt;So update({$or:&lt;/p&gt;
{x: [1,2,3])}
&lt;p&gt;, {$set:{y:1}}, true, true) should result in this document?&lt;br/&gt;
{_id:..., x:&lt;span class=&quot;error&quot;&gt;&amp;#91;1,2,3&amp;#93;&lt;/span&gt;, y:1}&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.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, 13 Sep 2010 21:31:13 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        13 years, 5 weeks, 3 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></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_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>
                            13 years, 5 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_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10021"><![CDATA[OS X]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-query</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>jeff</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpf67:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6612</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|ht0qbj:</customfieldvalue>

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