<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:02:49 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-3347] Option for not only closest distance but also closest location in $geoNear, potentially $near</title>
                <link>https://jira.mongodb.org/browse/SERVER-3347</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;There&apos;s no way currently to distinguish, in a multi-location document, the nearest location which generated the result.&lt;/p&gt;</description>
                <environment></environment>
        <key id="18841">SERVER-3347</key>
            <summary>Option for not only closest distance but also closest location in $geoNear, potentially $near</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="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="greg_10gen">Greg Studer</reporter>
                        <labels>
                            <label>qi-geo</label>
                    </labels>
                <created>Wed, 29 Jun 2011 17:30:54 +0000</created>
                <updated>Thu, 28 Dec 2023 18:40:36 +0000</updated>
                                                                            <component>Geo</component>
                    <component>Querying</component>
                                        <votes>2</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="52701" author="greg_10gen" created="Tue, 6 Sep 2011 22:17:41 +0000"  >&lt;p&gt;This would require some significant changes to the way in which we return keys in the geo code - so on hold for now.&lt;/p&gt;</comment>
                            <comment id="51021" author="l4u" created="Sat, 27 Aug 2011 02:26:52 +0000"  >&lt;p&gt;It would be nice if we can retrieve the index of embedded document, in additional to the distance, and location.&lt;/p&gt;</comment>
                            <comment id="49930" author="greg_10gen" created="Mon, 22 Aug 2011 17:49:37 +0000"  >&lt;p&gt;Because there isn&apos;t currently a standard annotate-doc-with-info codepath in mongodb until the aggregation framework is added, only limited support can be added for this in 2.0.  However, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3139&quot; title=&quot;Allow returning multi-location documents by either unique doc or result per location&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3139&quot;&gt;&lt;del&gt;SERVER-3139&lt;/del&gt;&lt;/a&gt; adds locations to results for geoNear queries using &quot;includeLocs : true&quot; , which should solve this problem in the short term.&lt;/p&gt;</comment>
                            <comment id="39932" author="tony_k" created="Thu, 30 Jun 2011 11:22:54 +0000"  >
&lt;p&gt;a couple of comments to consider when you start to think about a solution for this:&lt;/p&gt;

&lt;p&gt;(1) run/geoNear v. find/near syntax &lt;/p&gt;

&lt;p&gt;i need to preface this with the following context: although i&apos;m a relatively new mongo user, i&apos;m tremendously impressed with it&apos;s capability and potential, and have the utmost admiration for it&apos;s designers/developers, &lt;/p&gt;

&lt;p&gt;so these are just some nice-to-have usability comments that i think might enhance the experience. &lt;/p&gt;

&lt;p&gt;from what i can gather, to get sort of meta-data about a geo search (e.g. distance), we need to use the &quot;run command&quot; type syntax which delivers a response in a single document vs. the cursor type response delivered by &quot;find&quot; type syntax. &lt;/p&gt;

&lt;p&gt;these access styles end up manifesting differently enough in both command line and java driver syntax, that run/geoNear becomes trickier to understand and use than find/near. &lt;/p&gt;

&lt;p&gt;it would be nice if the syntax could be more consistent such that you could &quot;find&quot; a set of &quot;result&quot; objects that where kind of like the elements contained in the &quot;results&quot; field of the document returned by the &quot;run command&quot; syntax. &lt;/p&gt;

&lt;p&gt;something maybe like: &lt;/p&gt;

&lt;p&gt;db.collectionOfDocsWithArrayOfGeoLocations.geoFind({geoLocations: {$near: &lt;span class=&quot;error&quot;&gt;&amp;#91;x,y&amp;#93;&lt;/span&gt;}, food-type: &quot;chinese&quot;})&lt;/p&gt;

&lt;p&gt;or maybe even:&lt;/p&gt;

&lt;p&gt;db.collectionOfDocsWithArrayOfGeoLocations.metaFind({geoLocations: {$near: &lt;span class=&quot;error&quot;&gt;&amp;#91;x,y&amp;#93;&lt;/span&gt;}, food-type: &quot;chinese&quot;})&lt;/p&gt;

&lt;p&gt;if there are other scenarios where it could be useful to obtain &quot;meta&quot; information about queries such as other (non-geo) indexes used, etc:&lt;/p&gt;

&lt;p&gt;(2) &quot;meta&quot; information about which geo location mongo hit on &lt;/p&gt;

&lt;p&gt;now that you support multiple 2d indexes per collection, a hit could occur on either a &quot;singleton&quot; 2d index or an array 2d index, so both field/index name and potentially array index become interesting to the caller. &lt;/p&gt;

&lt;p&gt;it seems like sibling fields to &quot;distance&quot; on the run/geoNear result object would be a natural place to deliver information about which geo location mongo hit on for that document, for instance: &lt;/p&gt;

&lt;p&gt;distance: 0.12, &lt;br/&gt;
field: &quot;addresses.loc&quot;, &lt;br/&gt;
index: 3 &lt;/p&gt;

&lt;p&gt;(3) multiple hits on same document &lt;/p&gt;

&lt;p&gt;i believe the current implementation returns the same document multiple times if mongo finds multiple hits. &lt;/p&gt;

&lt;p&gt;another option for this would be to return the multi-hit document only once and include multiple &quot;hit meta&quot; objects in the result. &lt;/p&gt;

&lt;p&gt;so instead of single field/distance or field/distance/index per hit, return one of those tuples or triples for each hit in an array with a single copy of the document &lt;/p&gt;

&lt;p&gt;{ &lt;br/&gt;
  hits: [&lt;br/&gt;
    &lt;/p&gt;
{field: &quot;mainAddress.loc&quot;, distance: 0.12}
&lt;p&gt;, &lt;br/&gt;
    &lt;/p&gt;
{field: &quot;alternateAddresses.loc&quot;, distance: 0.34, index: 2}
&lt;p&gt;, &lt;/p&gt;
    {field: &quot;alternateAddresses.loc&quot;, distance: 0.45, index: 5}
&lt;p&gt;  ], &lt;br/&gt;
  document: &lt;/p&gt;
{ // the actual document }
&lt;p&gt; &lt;br/&gt;
} &lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="17469">SERVER-3139</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="32433">SERVER-5235</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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_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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 30 Jun 2011 11:22:54 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 24 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_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>alyssa.clark@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 24 weeks, 1 day 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_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-query-integration</customfieldvalue>
            <customfieldvalue>greg_10gen</customfieldvalue>
            <customfieldvalue>l4u</customfieldvalue>
            <customfieldvalue>tony_k</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrowrb:</customfieldvalue>

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

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

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