<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:38:06 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-78343] geoWithin not returning correct data</title>
                <link>https://jira.mongodb.org/browse/SERVER-78343</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The geoWithin query is not returning the data as expected. I have looked at large polygons mentioned here&#160;&lt;br/&gt;
&lt;a href=&quot;https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/#std-label-geowithin-big-poly&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/#std-label-geowithin-big-poly&lt;/a&gt;&lt;br/&gt;
&#160;&lt;br/&gt;
The polygons used however, are not large enough to cover the area of a hemisphere. See the example data and query.&lt;br/&gt;
&#160;&lt;br/&gt;
As we increase the polygon sizes up to a certain point the data is returned correctly however going bigger by one longitude unit returns incorrect data.&lt;br/&gt;
&#160;&lt;br/&gt;
For completeness though I have tried with&lt;br/&gt;
&#160;&lt;/p&gt;
&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;crs: {&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;type: &quot;name&quot;,&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;properties: 
{ name: &quot;urn:x-mongodb:crs:strictwinding:EPSG:4326&quot; }&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;}&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;&#160;&lt;br/&gt;
and get the same results.&lt;br/&gt;
&#160;&lt;br/&gt;
Can you please identify the mistake here.&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2374966">SERVER-78343</key>
            <summary>geoWithin not returning correct data</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13202">Works as Designed</resolution>
                                        <assignee username="will.buerger@mongodb.com">Will Buerger</assignee>
                                    <reporter username="khalidbashirbajwa@gmail.com">Khalid Bashir Bajwa</reporter>
                        <labels>
                            <label>greenerbuild</label>
                    </labels>
                <created>Thu, 22 Jun 2023 17:42:53 +0000</created>
                <updated>Sun, 29 Oct 2023 21:40:46 +0000</updated>
                            <resolved>Thu, 7 Sep 2023 14:19:53 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5827071" author="JIRAUSER1274210" created="Sun, 29 Oct 2023 21:40:46 +0000"  >&lt;p&gt;Thank you &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=will.buerger%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;will.buerger@mongodb.com&quot;&gt;will.buerger@mongodb.com&lt;/a&gt;. $polygon worked.&lt;/p&gt;</comment>
                            <comment id="5686411" author="JIRAUSER1260438" created="Thu, 7 Sep 2023 14:19:23 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=khalidbashirbajwa%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;khalidbashirbajwa@gmail.com&quot;&gt;khalidbashirbajwa@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The results you&#8217;re receiving are as expected. When using the $geoWithin operator, there are 2 &#8220;modes&#8221; with which the operator can check the geospatial condition. When you provide a shape with the geoJSON specification, with the $geometry operator, it checks for containment using the geodesic coordinate system, simulating the earth as a sphere. When you provide a shape with a non-geoJSON geometry, like the $polygon operator, it checks for containment using planar (flat) geometry, like looking at a map.&lt;/p&gt;

&lt;p&gt;Geodesic lines do not appear straight when projected onto a flat Cartesian coordinate system and can sometimes appear dramatically different than the Cartesian projection, as in this case. You can see by comparing these two visualizations that when you move one of the vertices in a way that you might think of as &#8220;expanding&#8221; the polygon, it actually causes the point to fall outside the resulting geodesic line.&lt;/p&gt;

&lt;p&gt;Before: &lt;a href=&quot;http://www.gcmap.com/mapui?P=16N+161W+-+16N+13W%2C+46.57502N+81.0976W&amp;amp;MS=bm&amp;amp;DU=mi&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.gcmap.com/mapui?P=16N+161W+-+16N+13W%2C+46.57502N+81.0976W&amp;amp;MS=bm&amp;amp;DU=mi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After: &lt;a href=&quot;http://www.gcmap.com/mapui?P=16N+161W+-+16N+12W%2C+46.57502N+81.0976W&amp;amp;MS=bm&amp;amp;DU=mi&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.gcmap.com/mapui?P=16N+161W+-+16N+12W%2C+46.57502N+81.0976W&amp;amp;MS=bm&amp;amp;DU=mi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might consider using $polygon rather than $geometry, if you want the results as you&#8217;ve described.&lt;/p&gt;

&lt;p&gt;Will&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="2398440">SERVER-79218</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="461166" name="image-2023-07-10-10-26-45-774.png" size="320809" author="will.buerger@mongodb.com" created="Mon, 10 Jul 2023 14:26:46 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.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>Mon, 26 Jun 2023 19:04:12 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        14 weeks, 3 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>khalidbashirbajwa@gmail.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            14 weeks, 3 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>khalidbashirbajwa@gmail.com</customfieldvalue>
            <customfieldvalue>will.buerger@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i2f0wn:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i1x79c:</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="7210">QI 2023-07-24</customfieldvalue>
    <customfieldvalue id="7211">QI 2023-08-07</customfieldvalue>
    <customfieldvalue id="7212">QI 2023-08-21</customfieldvalue>
    <customfieldvalue id="7213">QI 2023-09-04</customfieldvalue>
    <customfieldvalue id="7214">QI 2023-09-18</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Here is an example collection&lt;/p&gt;

&lt;p&gt;db.geo_json_test.insertMany([{name: &quot;00A&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.09670311007132, 46.575020657518266&amp;#93;&lt;/span&gt;}},{name: &quot;147&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.067788, 46.3822689&amp;#93;&lt;/span&gt;}},{name: &quot;001&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-92.16504975147868, 66.85083025648714&amp;#93;&lt;/span&gt;}},{name: &quot;002&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-80.9422811, 46.512260000000005&amp;#93;&lt;/span&gt;}},{name: &quot;000&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-80.942295, 46.51226270000001&amp;#93;&lt;/span&gt;}},{name: &quot;008&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.09670311007132, 46.575020657518266&amp;#93;&lt;/span&gt;}},{name: &quot;007&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.09653748648944, 46.575012427925024&amp;#93;&lt;/span&gt;}},{name: &quot;006&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.0972791024576, 46.57375187851832&amp;#93;&lt;/span&gt;}},{name: &quot;005&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.101199979413, 46.56988771702767&amp;#93;&lt;/span&gt;}},{name: &quot;004&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.05537133207827, 46.56975708845099&amp;#93;&lt;/span&gt;}},{name: &quot;003&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.09831646261244, 46.57729676918206&amp;#93;&lt;/span&gt;}},{name: &quot;02&quot;, location: {type: &quot;Point&quot;, coordinates: &lt;span class=&quot;error&quot;&gt;&amp;#91;-81.07875689437888, 46.56184186179797&amp;#93;&lt;/span&gt;}}])&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The following query to the collection returns all points&lt;/p&gt;

&lt;p&gt;db.geo_json_test.find({&apos;$and&apos;: [{&apos;location&apos;: {&apos;$geoWithin&apos;: {&apos;$geometry&apos;: {&apos;type&apos;: &apos;Polygon&apos;, &apos;coordinates&apos;: [[&lt;span class=&quot;error&quot;&gt;&amp;#91;-13, 71&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-161, 71&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-161, 16&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-13, 16&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-13, 71&amp;#93;&lt;/span&gt;]]}}}}]})&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;However, the following query which is changing the longitude by 1 unit further to the east returns only one point. This polygon is a little bigger than the previous one and should include all the points that were included in the previous one&lt;/p&gt;

&lt;p&gt;db.geo_json_test.find({&apos;$and&apos;: [{&apos;location&apos;: {&apos;$geoWithin&apos;: {&apos;$geometry&apos;: {&apos;type&apos;: &apos;Polygon&apos;, &apos;coordinates&apos;: [[&lt;span class=&quot;error&quot;&gt;&amp;#91;-12, 71&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-161, 71&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-161, 16&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-12, 16&amp;#93;&lt;/span&gt;, &lt;span class=&quot;error&quot;&gt;&amp;#91;-12, 71&amp;#93;&lt;/span&gt;]]}}}}]})&lt;/p&gt;</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>
                                    <customfieldvalue><![CDATA[yuan.fang@mongodb.com]]></customfieldvalue>
    

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i2en1z:</customfieldvalue>

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