<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 07:37:47 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-36] The documentation of $near seems wrong, or at least confusing</title>
                <link>https://jira.mongodb.org/browse/DOCS-36</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;p&gt;The second bullet point describing the spherical coordinates states that &quot;All distances use radians&quot;, and continues with &quot;... multiply by the radius of the earth (about 6371 km or 3959 miles) to get the distance in your choice of units.&quot;  Given the circumference of the earth being 2*pi*radius and the entire circle being 2*pi (radians) then one radian at the surface of the earth would be equal to the earth&apos;s radius, which is 3959 miles.&lt;br/&gt;
&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Geospatial+Indexing#GeospatialIndexing-NewSphericalModel&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Geospatial+Indexing#GeospatialIndexing-NewSphericalModel&lt;/a&gt;&lt;br/&gt;
On the other hand the last comment in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-813&quot; title=&quot;Add radius to $near&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-813&quot;&gt;&lt;del&gt;SERVER-813&lt;/del&gt;&lt;/a&gt; says that one (radian) corresponds to 69 miles on the surface of the earth.  Some empirical testing suggests that this is indeed the accurate measure.&lt;br/&gt;
&lt;a href=&quot;http://jira.mongodb.org/browse/SERVER-813?focusedCommentId=19076&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_19076&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;http://jira.mongodb.org/browse/SERVER-813?focusedCommentId=19076&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_19076&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However if we assume we&apos;re talking about one good old degree (1/360 of a circle) it does make more sense.  One degree would measure 1/360 * 2*pi*radius at the surface, which does indeed compute to about 69 miles.&lt;/p&gt;

&lt;p&gt;I would therefore propose that the documentation say &quot;All distances use decimal degrees, just like the coordinates themselves&quot;.  At least among my peers that seems to cause less confusion.&lt;/p&gt;</description>
                <environment></environment>
        <key id="15304">DOCS-36</key>
            <summary>The documentation of $near seems wrong, or at least confusing</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="9">Done</resolution>
                                        <assignee username="greg_10gen">Greg Studer</assignee>
                                    <reporter username="knut">Knut Forkalsrud</reporter>
                        <labels>
                    </labels>
                <created>Sat, 26 Mar 2011 06:34:34 +0000</created>
                <updated>Thu, 29 Nov 2012 16:35:02 +0000</updated>
                            <resolved>Thu, 31 Mar 2011 17:18:10 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="27489" author="greg_10gen" created="Thu, 31 Mar 2011 21:43:12 +0000"  >&lt;p&gt;Yep, though again, beware, the two searches are not exactly equivalent over large areas.  Picture the circle in the first case bounded by the not-quite-square shape of a grid section on a spherical globe.  &lt;/p&gt;</comment>
                            <comment id="27453" author="knut" created="Thu, 31 Mar 2011 19:21:52 +0000"  >&lt;p&gt;ok, I think I understand this now.  When switching from $near to $nearSphere I also need to change $maxDistance from degrees to radians.&lt;/p&gt;


&lt;p&gt;&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 1, lat : 0 }
&lt;p&gt; })  &lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 2, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 3, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 4, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 5, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 6, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 7, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 8, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 9, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.insert({ pos : &lt;/p&gt;
{ long : 10, lat : 0 }
&lt;p&gt; })&lt;br/&gt;
&amp;gt; db.points.ensureIndex(&lt;/p&gt;
{ pos : &quot;2d&quot; }
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;&amp;gt; db.points.find( { pos : &lt;/p&gt;
{ $near : [0,0] , $maxDistance : 5 }
&lt;p&gt; } ).count()                           &lt;br/&gt;
5&lt;br/&gt;
&amp;gt; db.points.find( { pos : &lt;/p&gt;
{ $nearSphere : [0,0] , $maxDistance : (5 * 2 * 3.1416 / 360) }
&lt;p&gt; } ).count()&lt;br/&gt;
5&lt;/p&gt;</comment>
                            <comment id="27042" author="greg_10gen" created="Mon, 28 Mar 2011 22:25:16 +0000"  >&lt;p&gt;I believe the comment in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-813&quot; title=&quot;Add radius to $near&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-813&quot;&gt;&lt;del&gt;SERVER-813&lt;/del&gt;&lt;/a&gt; is actually inaccurate, and the distance parameters and results of a $near query where spherical is not set to true will be in terms of decimal degrees long/lat*, as you mentioned.  However, when using spherical = true or $nearSphere queries, the units of distance parameters and results are in fact radians - for example, see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2408&quot; title=&quot;$within $centerSphere not implemented&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2408&quot;&gt;&lt;del&gt;SERVER-2408&lt;/del&gt;&lt;/a&gt; , where the problem was a very large 1-radian-bounded query which was searching in a 3959 mile area.  &lt;/p&gt;

&lt;p&gt;This seems to be a fairly frequent question, however, I agree the documentation should be clearer (or give an example!).  &lt;/p&gt;

&lt;p&gt;*The euclidean distance formula used to calculate non-spherical distances is strange in that using degrees long/lat will give you back distance &quot;in degrees long/lat&quot; but converting this into a metric like km or miles is only accurate over small distances, it is not a degree of a great-circle such as you describe above.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="11174" name="degree-radian.jpg" size="16122" author="knut" created="Sat, 26 Mar 2011 06:37:07 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 28 Mar 2011 22:25:16 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 46 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>jess.mokrzecki@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 46 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>greg_10gen</customfieldvalue>
            <customfieldvalue>knut</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrsjfb:</customfieldvalue>

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

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

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