<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:45:07 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-58670] Modernize DBClientBase query interface to avoid OP_QUERY-derived characteristics</title>
                <link>https://jira.mongodb.org/browse/SERVER-58670</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;em&gt;The Ultimate Goal&lt;/em&gt;: migrate DBClientBase towards the interface similar to&#160;&lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read&lt;/a&gt;. For example, a&#160;&lt;tt&gt;query()&lt;/tt&gt;&#160;API will take namespace, BSON filter and a special type with settings, rather than the current API that takes a Query with the filter and some settings embedded into it and other settings being passes in as additional parameters. As we do that, the Query type should be replaced by QueryOptions with statically typed fields (some of which might be BSON as required by the particular settings).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The Challenge&lt;/em&gt;: the Query type wraps around a BSON object that might contain both query filter and some query settings. For a few common settings, such as sort and hint, there are setters on Query type that integrate the settings into the internal BSON object in a well-defined way, but Query also provides&#160;&lt;em&gt;implicit&lt;/em&gt;&#160;constructor from BSON so there is no compiler check for what it might be get wrapped around. As a result, when it comes to processing a query, the code has to inspect Query&apos;s public &apos;obj&apos; member and be prepared to deal with complicated BSON. We also suspect that some of the settings passed around have become mute after OP_QUERY deprecation and could be removed but it&apos;s hard to verify when opaque BSON is used to pass them around.&lt;/p&gt;

&lt;p&gt;Due to wide usage of DBClientBase and Query types, a single change to reach the goal stated above isn&apos;t feasible and the proposed progression is as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/10gen/mongo/pull/215&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/10gen/mongo/pull/215&lt;/a&gt; did some preliminary cleanups.&lt;/p&gt;

&lt;p&gt;1. Split the query argument in&#160;&lt;tt&gt;query()&lt;/tt&gt;&#160;APIS into separate &apos;filter&apos; (as BSONObj) and &apos;querySettings&apos; (as Query) arguments.&lt;br/&gt;
 2. Replace Query constructor from BSON with an explicit factory so that all callsites that use the constructor become easily searchable (&lt;tt&gt;fromBSONDeprecated()&lt;/tt&gt;)&lt;br/&gt;
 3. Replace as many callsites that create Query from BSON with the default query construction, followed by calling individual setters for each option (NB: this means we might copy the internal BSON object a few times rather than create it once but, hopefully, this won&apos;t cause a noticeable perf impact). Add new setters as necessary (some might be removed later, when we confirm they&apos;ve been fully deprecated).&lt;br/&gt;
 4. Remove QUERY macro.&lt;/p&gt;

&lt;p&gt;The steps 1-4 have been implemented in &lt;a href=&quot;https://github.com/10gen/mongo/pull/292&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/10gen/mongo/pull/292&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;5. Investigate and remove/replace the remaining four callers of &lt;tt&gt;fromBSONDeprecated()&lt;/tt&gt;:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;(src/mongo/client/dbclient_rs.cpp) in DBClientReplicaSet::say under&#160;&lt;tt&gt;if (lastOp == dbQuery)&lt;/tt&gt;&#160;check &#8211; is this code still reachable?&lt;/li&gt;
	&lt;li&gt;(src/mongo/client/dbclient_rs.cpp) in DBClientReplicaSet::call under&#160;&lt;tt&gt;if (toSend.operation() == dbQuery)&lt;/tt&gt;&#160;check &#8211; is this code still reachable?&lt;/li&gt;
	&lt;li&gt;(src/mongo/db/repl/apply_ops.cpp) in _checkPrecondition &#8211; should/could preconditions use different format?&lt;/li&gt;
	&lt;li&gt;(src/mongo/scripting/mozjs/mongo.cpp) in MongoBase::Functions::find::call &#8211; should we still be supporting &apos;query/$query&apos; here?&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;6. When all Query construction from raw BSON is gone, the type will only handle a known fixed set of query properties, so it will become possible to replace the internal BSON field &apos;obj&apos; with statically typed fields, and callers that inspect &apos;obj&apos; will be able to switch to using specific statically typed accessors instead. There are currently 7 callers like this (search for &lt;tt&gt;getFullSettingsDeprecated()&lt;/tt&gt;).&lt;br/&gt;
 7. Rename the Query type into QueryOptions (or FindOptions) and incorporate into it the other options that are currently passed to the&#160;&lt;tt&gt;query()&lt;/tt&gt;&#160;APIs as separate arguments.&lt;br/&gt;
 8. Review and cleanup src/mongo/db/query/query_request_helper.cpp. There should be no vestiges of OP_QUERY left at this point.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1823904">SERVER-58670</key>
            <summary>Modernize DBClientBase query interface to avoid OP_QUERY-derived characteristics</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="13201">Fixed</resolution>
                                        <assignee username="irina.yatsenko@mongodb.com">Irina Yatsenko</assignee>
                                    <reporter username="david.storch@mongodb.com">David Storch</reporter>
                        <labels>
                    </labels>
                <created>Mon, 19 Jul 2021 15:48:18 +0000</created>
                <updated>Sun, 29 Oct 2023 21:50:42 +0000</updated>
                            <resolved>Mon, 23 Aug 2021 20:06:14 +0000</resolved>
                                                    <fixVersion>5.1.0-rc0</fixVersion>
                                    <component>Internal Client</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4107757" author="JIRAUSER1259052" created="Wed, 6 Oct 2021 18:35:30 +0000"  >&lt;p&gt;Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it&#8217;s been triggered. For more active release information, please keep an eye on #server-release. Thank you!&lt;/p&gt;</comment>
                            <comment id="4017964" author="JIRAUSER1259274" created="Mon, 23 Aug 2021 20:05:24 +0000"  >&lt;p&gt;Filed &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-59512&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-59512&lt;/a&gt; to track the remaining work.&lt;/p&gt;</comment>
                            <comment id="4017911" author="xgen-internal-githook" created="Mon, 23 Aug 2021 19:45:02 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Irina Yatsenko&apos;, &apos;email&apos;: &apos;irina.yatsenko@mongodb.com&apos;, &apos;username&apos;: &apos;IrinaYatsenko&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-58670&quot; title=&quot;Modernize DBClientBase query interface to avoid OP_QUERY-derived characteristics&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-58670&quot;&gt;&lt;del&gt;SERVER-58670&lt;/del&gt;&lt;/a&gt; Tighten up what kind of BSON the &apos;Query&apos; type can be wrapped around&lt;/p&gt;

&lt;p&gt;This refactor includes:&lt;br/&gt;
  Remove dead code from &apos;Query&apos; type and reduce it public interface.&lt;br/&gt;
  Split query argument in query/update/removed methods into filter BSON and settings (which are still passed around as &apos;Query&apos; type).&lt;br/&gt;
  Remove Query(string) constructors.&lt;br/&gt;
  Remove most callers of &apos;Query(const BSONObj&amp;amp;)&apos;.&lt;br/&gt;
  Replace public &apos;Query(const BSON&amp;amp;)&apos; and &apos;Query.obj&apos; with an explicit factory method and a getter.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/df329d8f46e1485dd5d70379f9c48bf4175f0d5a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/df329d8f46e1485dd5d70379f9c48bf4175f0d5a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4017910" author="xgen-internal-githook" created="Mon, 23 Aug 2021 19:44:56 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Irina Yatsenko&apos;, &apos;email&apos;: &apos;irina.yatsenko@mongodb.com&apos;, &apos;username&apos;: &apos;IrinaYatsenko&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-58670&quot; title=&quot;Modernize DBClientBase query interface to avoid OP_QUERY-derived characteristics&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-58670&quot;&gt;&lt;del&gt;SERVER-58670&lt;/del&gt;&lt;/a&gt; Tighten up what kind of BSON the &apos;Query&apos; type can be wrapped around&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/10gen/mongo-enterprise-modules/commit/f3b098266be508b049fa36dcb6f3671830374e20&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/10gen/mongo-enterprise-modules/commit/f3b098266be508b049fa36dcb6f3671830374e20&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4000140" author="xgen-internal-githook" created="Sat, 14 Aug 2021 23:54:28 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Irina Yatsenko&apos;, &apos;email&apos;: &apos;irina.yatsenko@mongodb.com&apos;, &apos;username&apos;: &apos;IrinaYatsenko&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-58670&quot; title=&quot;Modernize DBClientBase query interface to avoid OP_QUERY-derived characteristics&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-58670&quot;&gt;&lt;del&gt;SERVER-58670&lt;/del&gt;&lt;/a&gt; Modernize DBClientBase query interface to avoid OP_QUERY-derived characteristics&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1f64d42977db0572b08d7ab19133bc3f21323ce0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1f64d42977db0572b08d7ab19133bc3f21323ce0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3970484" author="david.storch" created="Thu, 29 Jul 2021 14:22:16 +0000"  >&lt;p&gt;We should also look into deleting &lt;a href=&quot;https://github.com/mongodb/mongo/blob/a4b5e8e8c198d3e7d59c76996613b322872af186/src/mongo/client/dbclient_base.h#L138&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;DBClientBase::findN()&lt;/a&gt; as part of this ticket. We noticed that this method has very few callers, and those callers could easily be migrated onto the regular &lt;tt&gt;DBClientBase::query()&lt;/tt&gt; API.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1858379">SERVER-59512</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 10 Aug 2021 17:32:05 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 18 weeks 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-912</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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 18 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>irina.yatsenko@mongodb.com</customfieldvalue>
            <customfieldvalue>vivian.ge@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzt3y7:</customfieldvalue>

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

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

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="4713">QE 2021-08-09</customfieldvalue>
    <customfieldvalue id="4715">QE 2021-08-23</customfieldvalue>
    <customfieldvalue id="4717">QE 2021-09-06</customfieldvalue>

                        </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|hzsq7b:</customfieldvalue>

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