<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:57:16 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-1527] findandmodify positional operator $ in C++ driver</title>
                <link>https://jira.mongodb.org/browse/SERVER-1527</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Seems to be related to this issue:&quot; findandmodify doesn&apos;t support positional ($) operator&quot; =&amp;gt; &lt;a href=&quot;http://jira.mongodb.org/browse/SERVER-1095&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;http://jira.mongodb.org/browse/SERVER-1095&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I attempt to execute a positional set operation, the following error is emitted on the console: (with same example as linked).&lt;/p&gt;

&lt;p&gt;update EXAMPLE_ARRAY  query: &lt;/p&gt;
{ _id: ObjectId(&apos;4c6a7075c42868719b80c2e1&apos;) }
&lt;p&gt; byid  exception 13048 can&apos;t append to array using string field name &lt;span class=&quot;error&quot;&gt;&amp;#91;$&amp;#93;&lt;/span&gt; 0ms&lt;/p&gt;

&lt;p&gt;It works fine when I use the console.  My find-and-modify command is as follows:&lt;/p&gt;

&lt;p&gt; BSONObjBuilder b;&lt;br/&gt;
   b &amp;lt;&amp;lt; &quot;findandmodify&quot; &amp;lt;&amp;lt; collection_name.c_str() &amp;lt;&amp;lt;&lt;br/&gt;
         &quot;query&quot; &amp;lt;&amp;lt; Query(query) &amp;lt;&amp;lt;&lt;br/&gt;
         &quot;update&quot; &amp;lt;&amp;lt; update &amp;lt;&amp;lt;&lt;br/&gt;
         &quot;new&quot; &amp;lt;&amp;lt; see_modified;&lt;/p&gt;


&lt;p&gt;   bool result = dbcb-&amp;gt;runCommand(string(MONGO_DBNAME),&lt;br/&gt;
         b.obj(),&lt;br/&gt;
         rtn);&lt;/p&gt;

&lt;p&gt;The query phase works perfectly well.&lt;/p&gt;</description>
                <environment>Ubuntu 10.1, </environment>
        <key id="12812">SERVER-1527</key>
            <summary>findandmodify positional operator $ in C++ driver</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="mathias@mongodb.com">Mathias Stearn</assignee>
                                    <reporter username="m.savy">m savy</reporter>
                        <labels>
                    </labels>
                <created>Tue, 17 Aug 2010 11:44:06 +0000</created>
                <updated>Fri, 30 Mar 2012 14:26:44 +0000</updated>
                            <resolved>Mon, 28 Feb 2011 21:44:13 +0000</resolved>
                                    <version>1.6.0</version>
                                                    <component>Internal Client</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="24871" author="redbeard0531" created="Mon, 28 Feb 2011 21:44:13 +0000"  >&lt;p&gt;Clearing out old cases. Please let me know if you are still having issues&lt;/p&gt;</comment>
                            <comment id="20015" author="redbeard0531" created="Wed, 3 Nov 2010 21:44:53 +0000"  >&lt;p&gt;Sorry, I seemed to have missed your comment. &lt;/p&gt;

&lt;p&gt;BSONObj is the class for BSON objects. BSON is a macro to make them.&lt;/p&gt;

&lt;p&gt;Query is a helper class to make the BSONObj for calls to find() including flags like sort and explain. It shouldn&apos;t be used with commands.&lt;/p&gt;</comment>
                            <comment id="18481" author="m.savy" created="Thu, 23 Sep 2010 23:23:25 +0000"  >&lt;p&gt;I&apos;ve been really busy recently and haven&apos;t had a chance to test.  &lt;/p&gt;

&lt;p&gt;The query macro is a BSONobject?  I remember trying this directly without using the query macro but it caused some of my other queries to break.&lt;/p&gt;

&lt;p&gt;When I have a bit of time I&apos;ll double check what is going on.&lt;/p&gt;</comment>
                            <comment id="18479" author="redbeard0531" created="Thu, 23 Sep 2010 23:06:36 +0000"  >&lt;p&gt;Were you able to resolve your issue?&lt;/p&gt;</comment>
                            <comment id="17904" author="redbeard0531" created="Wed, 8 Sep 2010 17:45:57 +0000"  >&lt;p&gt;I&apos;m attaching a simple file to prove that findAndModify works with the c++ driver. You can compile it with: &lt;/p&gt;

&lt;p&gt;g++ test.cpp -lmongoclient -lboost_thread-mt -lboost_system-mt&lt;/p&gt;

&lt;p&gt;The only issue I think I see in your code is that you are using a Query object instead of a BSONObj. Is there any reason for this?&lt;/p&gt;</comment>
                            <comment id="17450" author="m.savy" created="Thu, 26 Aug 2010 14:17:05 +0000"  >&lt;p&gt;Yes, in the actual version I used the dollars are in quotations, but I simplified it here - of course it would not compile otherwise with random $ symbols. As I stated in the original comment it works fine in the JS shell.  &lt;/p&gt;

&lt;p&gt;Perhaps you have managed to replicate it without the problem (which would be odd, and suggest I&apos;ve done something strange)?&lt;/p&gt;</comment>
                            <comment id="17381" author="redbeard0531" created="Wed, 25 Aug 2010 17:41:03 +0000"  >&lt;p&gt;You don&apos;t seem to be quoting your string keys. CURRENT_ASSIGNEES.$.EXPIRY  should probably be CURRENT_ASSIGNEES&quot;.$.&quot;EXPIRY, assuming that those are string macros.&lt;/p&gt;

&lt;p&gt;Have you tried the equivalent findAndModify using the JS shell?&lt;/p&gt;</comment>
                            <comment id="16971" author="m.savy" created="Tue, 17 Aug 2010 13:41:43 +0000"  >&lt;p&gt;Code I was trying to use:&lt;/p&gt;

&lt;p&gt;/&lt;b&gt;Current assignees is an array&lt;/b&gt;/&lt;/p&gt;

&lt;p&gt;==== Query:&lt;br/&gt;
BSONObjBuilder b;&lt;br/&gt;
b &amp;lt;&amp;lt; CURRENT_ASSIGNEES&quot;.&quot;TOKEN &amp;lt;&amp;lt; token.c_str();&lt;br/&gt;
return b.obj();&lt;/p&gt;

&lt;p&gt;==== Update:&lt;/p&gt;

&lt;p&gt;BSONObjBuilder b;&lt;br/&gt;
   //Set new expiry&lt;br/&gt;
   b &amp;lt;&amp;lt; &quot;$set&quot; &amp;lt;&amp;lt; BSON(CURRENT_ASSIGNEES.$.EXPIRY &amp;lt;&amp;lt;t) &amp;lt;&amp;lt;&lt;br/&gt;
         //Revert checkins to zero&lt;br/&gt;
         &quot;$set&quot; &amp;lt;&amp;lt; BSON(CURRENT_ASSIGNEES.$.FAILED_CHECKINS &amp;lt;&amp;lt; 0);&lt;/p&gt;

&lt;p&gt;return b.obj();&lt;/p&gt;

&lt;p&gt;==== Find and modify method signature&lt;/p&gt;

&lt;p&gt;static BSONObj find_and_modify(shared_ptr&amp;lt;DBClientBase&amp;gt; dbcb, const string &amp;amp;collection_name,&lt;br/&gt;
      const BSONObj query, const BSONObj update, bool see_modified=true, bool upsert = false)&lt;/p&gt;


&lt;p&gt;Works fine with update() on this query/update pair.&lt;/p&gt;


&lt;p&gt;Demonstration structure info:&lt;/p&gt;

&lt;p&gt;{&quot;DemoAttr&quot; : &quot;blah&quot;,&lt;br/&gt;
&quot;CURRENT_ASSIGNEES&quot; : [&lt;/p&gt;
	{
		&quot;TOKEN&quot; : &amp;lt;some token&amp;gt;,
		&quot;USER&quot; : &quot;test-usr&quot;,
		&quot;FAILED_CHECKINS&quot; : 0
	}
&lt;p&gt;]&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="16970" author="eliot" created="Tue, 17 Aug 2010 13:32:37 +0000"  >&lt;p&gt;you need an array query part in the query to use $&lt;/p&gt;

&lt;p&gt;can you send your full update&lt;/p&gt;</comment>
                            <comment id="16968" author="m.savy" created="Tue, 17 Aug 2010 11:46:38 +0000"  >&lt;p&gt;note that see modified was set to true.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="10432" name="test.cpp" size="635" author="mathias@mongodb.com" created="Wed, 8 Sep 2010 17:45:57 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>10.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 17 Aug 2010 13:32:37 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 51 weeks, 2 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>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 51 weeks, 2 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="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>mathias@mongodb.com</customfieldvalue>
            <customfieldvalue>m.savy</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpiev:</customfieldvalue>

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

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

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