<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:40:17 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-35581] Don&apos;t mandate the use of &quot;distanceField&quot; in $geoNear</title>
                <link>https://jira.mongodb.org/browse/SERVER-35581</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The &lt;tt&gt;$geoNear&lt;/tt&gt; stage&#160;requires that &quot;distanceField&quot; is specified. Presumably, this was required to allow &lt;tt&gt;$geoNear&lt;/tt&gt; to work in a sharded cluster, as mongos must take the results from each shard and merge them in ascending order of distance. However, users that aren&apos;t interested in the actual distance will have to project out the field in their results.&lt;/p&gt;

&lt;p&gt;When &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-35043&quot; title=&quot;Remove geoNear command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-35043&quot;&gt;&lt;del&gt;SERVER-35043&lt;/del&gt;&lt;/a&gt; is complete, &lt;tt&gt;DocumentSourceGeoNearCursor&lt;/tt&gt; could ensure that the sort key is set to be the computed distance without requiring that &quot;distanceField&quot; is actually added to the output.&lt;/p&gt;</description>
                <environment></environment>
        <key id="558681">SERVER-35581</key>
            <summary>Don&apos;t mandate the use of &quot;distanceField&quot; in $geoNear</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-integration">Backlog - Query Integration</assignee>
                                    <reporter username="kyle.suarez@mongodb.com">Kyle Suarez</reporter>
                        <labels>
                            <label>neweng</label>
                            <label>qi-geo</label>
                            <label>qi-quick-win-candidate</label>
                    </labels>
                <created>Wed, 13 Jun 2018 18:42:47 +0000</created>
                <updated>Sat, 3 Feb 2024 00:07:49 +0000</updated>
                                                                            <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="4119583" author="david.percy" created="Tue, 12 Oct 2021 17:59:48 +0000"  >&lt;p&gt;I attempted this as part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-58443&quot; title=&quot;Allow $near/$nearSphere on a view&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-58443&quot;&gt;SERVER-58443&lt;/a&gt;.&#160; (I had to revert that commit for performance reasons, but not because of distanceField.)&lt;/p&gt;

&lt;p&gt;It looked like we are already setting some metadata (the sort key or maybe the geo distance), and mongos is using that to merge the results.&lt;/p&gt;</comment>
                            <comment id="1957438" author="kyle.suarez" created="Thu, 26 Jul 2018 15:04:44 +0000"  >&lt;p&gt;Yes, you&apos;re exactly correct. The special &lt;tt&gt;$sortKey&lt;/tt&gt; field tells us the value that we should be sorting on, such that a sharded merge can merge sorted streams. Therefore, we don&apos;t need the &quot;distanceField&quot; at all. In a post-&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33323&quot; title=&quot;Refactor $mergeCursors stage to allow it to be used to merge cursors on mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33323&quot;&gt;&lt;del&gt;SERVER-33323&lt;/del&gt;&lt;/a&gt; world, Charlie will change the cluster aggregation merging logic such that we only need to indicate the direction of the sort: either ascending or descending on the sort key. That will eliminate that DocumentSourceSort once and for all.&lt;/p&gt;</comment>
                            <comment id="1956880" author="lennykhazan" created="Wed, 25 Jul 2018 22:21:58 +0000"  >&lt;p&gt;Thanks to you both for the info and feedback. I was under the impression that &lt;a href=&quot;https://github.com/mongodb/mongo/blob/cee5620706ccfe36eefba83fe2679248669d086b/src/mongo/db/pipeline/document_source_geo_near_cursor.cpp#L111-L114&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this chunk of code&lt;/a&gt; sets some metafield by which results can be merged across shards &#8212; does it serve some other purpose?&lt;/p&gt;</comment>
                            <comment id="1956780" author="kyle.suarez" created="Wed, 25 Jul 2018 21:18:30 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=asya&quot; class=&quot;user-hover&quot; rel=&quot;asya&quot;&gt;asya&lt;/a&gt; has reminded me that, in a sharded cluster, we must ensure that the merging shard correctly merges documents produced by $geoNear in ascending order of distance (even if the distance is not present in the document). That logic is encapsulated &lt;a href=&quot;https://github.com/mongodb/mongo/blob/cee5620706ccfe36eefba83fe2679248669d086b/src/mongo/db/pipeline/document_source_geo_near.cpp#L238-L241&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;in &lt;tt&gt;DocumentSourceGeoNear::getMergeSources()&lt;/tt&gt;&lt;/a&gt;&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;std::list&amp;lt;boost::intrusive_ptr&amp;lt;DocumentSource&amp;gt;&amp;gt; DocumentSourceGeoNear::getMergeSources() {&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;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;return&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; {DocumentSourceSort::create(&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;        pExpCtx, BSON(distanceField-&amp;gt;fullPath() &amp;lt;&amp;lt; 1 &amp;lt;&amp;lt; &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;$mergePresorted&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; &amp;lt;&amp;lt; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;true&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;   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;However, in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33323&quot; title=&quot;Refactor $mergeCursors stage to allow it to be used to merge cursors on mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33323&quot;&gt;&lt;del&gt;SERVER-33323&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=charlie.swanson&quot; class=&quot;user-hover&quot; rel=&quot;charlie.swanson&quot;&gt;charlie.swanson&lt;/a&gt; is working on a different way to merge aggregations in a sharded cluster that will obviate the need for a DocumentSourceSort.&lt;/p&gt;

&lt;p&gt;I&apos;ve marked this ticket as depending on &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33323&quot; title=&quot;Refactor $mergeCursors stage to allow it to be used to merge cursors on mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33323&quot;&gt;&lt;del&gt;SERVER-33323&lt;/del&gt;&lt;/a&gt;. That work is in code review now and I anticipate it landing soon. I&apos;d suggest holding off attempting this ticket until that one is committed, especially because I anticipate many confusing merge conflicts.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Kyle&lt;/p&gt;</comment>
                            <comment id="1956579" author="kyle.suarez" created="Wed, 25 Jul 2018 18:43:15 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=lennykhazan&quot; class=&quot;user-hover&quot; rel=&quot;lennykhazan&quot;&gt;lennykhazan&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The intent behind &lt;tt&gt;DocumentSource::getOutputSorts()&lt;/tt&gt; was to expose sort orders to the aggregation planner so that we could take advantage of sorted sequences. However, the planner currently does not use it at all &amp;#8211; work to track that is in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-22966&quot; title=&quot;Aggregation should use the output of DocumentSource::getOutputSorts() to optimize wherever possible.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-22966&quot;&gt;SERVER-22966&lt;/a&gt;, and right now we have no plans to schedule it in the near future.&lt;/p&gt;

&lt;p&gt;As part of this ticket, it would be perfectly fine to simply delete &lt;tt&gt;DocumentSourceGeoNearCursor::getOutputSorts()&lt;/tt&gt;; it won&apos;t affect the correctness of the system.&lt;/p&gt;

&lt;p&gt;Thanks again for offering to help!&lt;br/&gt;
Kyle&lt;/p&gt;</comment>
                            <comment id="1956462" author="asya" created="Wed, 25 Jul 2018 17:29:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=lennykhazan&quot; class=&quot;user-hover&quot; rel=&quot;lennykhazan&quot;&gt;lennykhazan&lt;/a&gt;&#160;&lt;/p&gt;

&lt;p&gt;Thank you for your offer to help.&#160; In order for us to accept a pull request we need a signed &lt;a href=&quot;https://www.mongodb.com/legal/contributor-agreement&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;contributor agreement&lt;/a&gt;.  You can see other &lt;a href=&quot;https://github.com/mongodb/mongo/wiki#contributing-to-mongodb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;contibutor guidelines&lt;/a&gt; in our Wiki.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kyle.suarez&quot; class=&quot;user-hover&quot; rel=&quot;kyle.suarez&quot;&gt;kyle.suarez&lt;/a&gt; will help you with your question about handling the distance field.   &lt;/p&gt;

&lt;p&gt;Feel free to join the &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-dev&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Developer Google Group&lt;/a&gt; if you also have more general question  about development of MongoDB server.&lt;/p&gt;

&lt;p&gt;Asya&lt;/p&gt;</comment>
                            <comment id="1953086" author="lennykhazan" created="Sun, 22 Jul 2018 03:40:28 +0000"  >&lt;p&gt;I can take a crack at this. Making &lt;tt&gt;distanceField&lt;/tt&gt; optional seems straightforward enough, but it&apos;s not immediately clear to me how&lt;br/&gt;
&lt;tt&gt;DocumentSourceGeoNearCursor::getOutputSorts&lt;/tt&gt; is to be implemented if we are not necessarily saving the distance as a field on the output docs anymore &#8212; any help would be appreciated!&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="497821">SERVER-33323</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10020">
                    <name>Gantt Dependency</name>
                                                                <inwardlinks description="has to be done after">
                                        <issuelink>
            <issuekey id="545554">SERVER-35043</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1802504">SERVER-58443</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>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25467"><![CDATA[Query Integration]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sun, 22 Jul 2018 03:40:28 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 17 weeks, 1 day 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-33323'>SERVER-33323</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-3664</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>brenda.rodriguez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 17 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-query-integration</customfieldvalue>
            <customfieldvalue>david.percy@mongodb.com</customfieldvalue>
            <customfieldvalue>kyle.suarez@mongodb.com</customfieldvalue>
            <customfieldvalue>lennykhazan</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu0huf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2gcv:</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_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|hu043r:</customfieldvalue>

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