<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:02: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>[DOCS-11099] Docs for SERVER-31651: geoNear command and $geoNear agg stage should accept a &quot;key&quot; field</title>
                <link>https://jira.mongodb.org/browse/DOCS-11099</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;h2&gt;&lt;a name=&quot;Scopeofchanges%3A&quot;&gt;&lt;/a&gt;Scope of changes:&lt;/h2&gt;

&lt;p&gt;There are several things to document related to the changes for this ticket.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&#160;1) The &lt;tt&gt;minDistance&lt;/tt&gt; option to the geoNear command and $geoNear aggregation stage can now be used with a &quot;2d&quot; index. The same is true for the &lt;tt&gt;$minDistance&lt;/tt&gt; option to the &lt;tt&gt;$near&lt;/tt&gt; and &lt;tt&gt;$nearSphere&lt;/tt&gt; query predicates.&lt;/p&gt;

&lt;p&gt;We document in several places that &lt;tt&gt;minDistance&lt;/tt&gt; is only allowed for near queries that use a &quot;2dsphere&quot; index:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/geoNear/#dbcmd.geoNear&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/command/geoNear/#dbcmd.geoNear&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/operator/query/minDistance/#op._S_minDistance&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/operator/query/minDistance/#op._S_minDistance&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/operator/query/nearSphere/#op._S_nearSphere&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/operator/query/nearSphere/#op._S_nearSphere&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/operator/query/near/#op._S_near&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/operator/query/near/#op._S_near&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This is no longer the case.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; 2) The &lt;tt&gt;spherical&lt;/tt&gt; option to the geoNear command and $geoNear stage is no longer required for queries that use a &quot;2dsphere&quot; index.&lt;/p&gt;

&lt;p&gt;This is subtle and kind of confusing. The old behavior was that, for any geoNear/$geoNear using a &quot;2dsphere&quot; index, the command would fail unless &lt;tt&gt;spherical&lt;/tt&gt; was explicitly specified as true. We currently document that &lt;tt&gt;spherical&lt;/tt&gt; is required for &quot;2dsphere&quot; indexes in a few places:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/geoNear/#dbcmd.geoNear&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/command/geoNear/#dbcmd.geoNear&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/operator/aggregation/geoNear/#pipe._S_geoNear&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/operator/aggregation/geoNear/#pipe._S_geoNear&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This ticket changes the &lt;tt&gt;spherical&lt;/tt&gt; option such that spherical=true is identical in meaning to the &lt;tt&gt;$nearSphere&lt;/tt&gt; query predicate and spherical=false is identical in meaning to the &lt;tt&gt;$near&lt;/tt&gt; query predicate. This means that:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;The &lt;tt&gt;spherical&lt;/tt&gt; flag &lt;em&gt;must&lt;/em&gt; be set to true when using a legacy coordinate pair with a &quot;2dsphere&quot; index. In this case, distances will be in radians.&lt;/li&gt;
	&lt;li&gt;The flag has no effect when using a GeoJSON point with a &quot;2dsphere&quot; index, since GeoJSON always implies a spherical CRS and can never be used with a &quot;2d&quot; index. Distances will be in meters.&lt;/li&gt;
	&lt;li&gt;When using a &quot;2d&quot; index, the flag controls whether or not a flat or spherical CRS is used. In the case of spherical, the search point must be specified as a legacy coordinate pair, and distances are in radians.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I think this behavior could be summarized in two ways. The first is &quot;The spherical flag controls whether &lt;tt&gt;$near&lt;/tt&gt; or &lt;tt&gt;$nearSphere&lt;/tt&gt; semantics are used.&quot; The second is, &quot;When using a &apos;2d&apos; index, the spherical flag controls whether to calculate distances using a planar or spherical geometry&quot;. In any case, we need to remove the sentences that say &quot;Required if using a 2dsphere index.&quot;.&lt;/p&gt;

&lt;p&gt;3) This ticket adds a new &lt;tt&gt;key&lt;/tt&gt; param which is accepted by both the geoNear command and the $geoNear stage, and is used to specify the field path over which to compute the near.&lt;/p&gt;

&lt;p&gt;This parameter needs to be documented in both places. We should probably also add an example. Finally, we need to remove or modify sentences like this one: &quot;However, the geoNear command requires that a collection have at most only one 2dsphere and/or only one 2d index .&quot; This is no longer true, since &lt;tt&gt;key&lt;/tt&gt; can be used to disambiguate in the case of multiple geo indexes in the same collection.&lt;/p&gt;

&lt;p&gt;Feel free to reach out to me with any questions and/or send a code review my way!&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;Impacttootherdocsoutsideofthisproduct%3A&quot;&gt;&lt;/a&gt;Impact to other docs outside of this product:&lt;/h2&gt;
&lt;h2&gt;&lt;a name=&quot;MVP%3A&quot;&gt;&lt;/a&gt;MVP:&lt;/h2&gt;
&lt;h2&gt;&lt;a name=&quot;Resources%3A&quot;&gt;&lt;/a&gt;Resources:&lt;/h2&gt;
&lt;h3&gt;&lt;a name=&quot;EngineeringTicketDescription%3A&quot;&gt;&lt;/a&gt;Engineering Ticket Description:&lt;/h3&gt;

&lt;p&gt;The &lt;tt&gt;geoNear&lt;/tt&gt; command and the &lt;tt&gt;$geoNear&lt;/tt&gt; agg stage currently infer the field path over which to perform the search based on the presence of a &quot;2d&quot; or &quot;2dsphere&quot; index:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/88c39edf9275e47e5db4b1dbffb0bf51f9187731/src/mongo/db/commands/geo_near_cmd.cpp#L124-L130&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/88c39edf9275e47e5db4b1dbffb0bf51f9187731/src/mongo/db/commands/geo_near_cmd.cpp#L124-L130&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The command will fail if there are multiple geo indexes.&lt;/p&gt;

&lt;p&gt;In order to improve this behavior, we should extend the command and agg stage to accept an optional &lt;tt&gt;key&lt;/tt&gt; field. This field must be a string, and will be interpreted as the field path over which to run the search. In order to avoid breaking existing applications, the existing behavior should be preserved when the &lt;tt&gt;key&lt;/tt&gt; field is omitted.&lt;/p&gt;</description>
                <environment></environment>
        <key id="469621">DOCS-11099</key>
            <summary>Docs for SERVER-31651: geoNear command and $geoNear agg stage should accept a &quot;key&quot; field</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="allison.moore@mongodb.com">Allison Reinheimer Moore</assignee>
                                    <reporter username="kay.kim@mongodb.com">Kay Kim</reporter>
                        <labels>
                            <label>docs-grab-0504</label>
                    </labels>
                <created>Fri, 8 Dec 2017 00:39:03 +0000</created>
                <updated>Sun, 29 Oct 2023 13:58:41 +0000</updated>
                            <resolved>Mon, 25 Jun 2018 15:25:42 +0000</resolved>
                                                    <fixVersion>3.7.1</fixVersion>
                                        <due>Fri, 4 May 2018 00:00:00 +0000</due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2028160" author="xgen-internal-githook" created="Tue, 9 Oct 2018 18:21:46 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;kay&apos;, &apos;email&apos;: &apos;kay.kim@10gen.com&apos;, &apos;username&apos;: &apos;kay-kim&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-11099&quot; title=&quot;Docs for SERVER-31651: geoNear command and $geoNear agg stage should accept a &amp;quot;key&amp;quot; field&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-11099&quot;&gt;&lt;del&gt;DOCS-11099&lt;/del&gt;&lt;/a&gt;: tweak wording for key for $geoNear in 4.2&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/ce8c97d9aa20b6caea02503d5c87637db31b88a6&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/ce8c97d9aa20b6caea02503d5c87637db31b88a6&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1981861" author="xgen-internal-githook" created="Tue, 21 Aug 2018 21:24:12 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;kay&apos;, &apos;email&apos;: &apos;kay.kim@10gen.com&apos;, &apos;username&apos;: &apos;kay-kim&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-11099&quot; title=&quot;Docs for SERVER-31651: geoNear command and $geoNear agg stage should accept a &amp;quot;key&amp;quot; field&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-11099&quot;&gt;&lt;del&gt;DOCS-11099&lt;/del&gt;&lt;/a&gt;: tweak wording for key for $geoNear in 4.2&lt;br/&gt;
Branch: upcoming-4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/049d9a17d71e276f384f600bb7e2b65469666043&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/049d9a17d71e276f384f600bb7e2b65469666043&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1981849" author="xgen-internal-githook" created="Tue, 21 Aug 2018 21:11:35 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;kay&apos;, &apos;email&apos;: &apos;kay.kim@10gen.com&apos;, &apos;username&apos;: &apos;kay-kim&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-11099&quot; title=&quot;Docs for SERVER-31651: geoNear command and $geoNear agg stage should accept a &amp;quot;key&amp;quot; field&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-11099&quot;&gt;&lt;del&gt;DOCS-11099&lt;/del&gt;&lt;/a&gt;: tweak wording for key for \$geoNear and deprecated geoNear command on 4.0.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/2dc9938ec894a2400e7b3e35d7c9d4dcb3ca8c3b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/2dc9938ec894a2400e7b3e35d7c9d4dcb3ca8c3b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1930570" author="xgen-internal-githook" created="Mon, 25 Jun 2018 15:29:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;schmalliso&apos;, &apos;name&apos;: &apos;Allison Reinheimer Moore&apos;, &apos;email&apos;: &apos;allison.moore@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-11099&quot; title=&quot;Docs for SERVER-31651: geoNear command and $geoNear agg stage should accept a &amp;quot;key&amp;quot; field&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-11099&quot;&gt;&lt;del&gt;DOCS-11099&lt;/del&gt;&lt;/a&gt;: clarifies spherical behavior, adds keys param to geoNear&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/f195a5413d07c1cf7979f13b66521e73c42a2eac&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/f195a5413d07c1cf7979f13b66521e73c42a2eac&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10320">
                    <name>Documented</name>
                                            <outwardlinks description="documents">
                                        <issuelink>
            <issuekey id="448383">SERVER-31651</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>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 15 Jun 2018 17:45:01 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 18 weeks, 1 day 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>DOCS-11003</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>
                            5 years, 18 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>allison.moore@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kay.kim@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htltcf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsqyav:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1324">KANBAN BUCKET</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_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htlfgf:</customfieldvalue>

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