<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:58:35 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-63756] maxDistance field on GeoNear query not accepting field number</title>
                <link>https://jira.mongodb.org/browse/SERVER-63756</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I have the following GeoNear aggregation I am running some documents. max_travel_radius is a float field on the objects that I am trying to pull into the maxDistance field for the aggregation, and is different for each document. Each time I run the query, it produces the error &apos;maxDistance must be a number&apos;, never allowing me to use a field although running it with a single, hard coded number works.&#160;&lt;/p&gt;

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

&lt;p&gt;Ultimately what I am trying to do is send out a request for service from one customer application (the &apos;near&apos; field) and check if there are any service providers (the &apos;key&apos; field, which I have as point coordinates on the document) and only return providers which are within the given search radius (&apos;maxDistance&apos;). Each service provider document should be able to set their own max travel distance as a stored variable which can then be used in the GeoNear query to check if they are within range of a new service request.&#160;&lt;/p&gt;

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

&lt;p&gt;Here is an example of a GeoNear query I am running:&lt;/p&gt;

{
 &quot;near&quot;: \{type: &quot;Point&quot;, coordinates: [-111.887277, 40.770020]}
&lt;p&gt;,&lt;br/&gt;
 &quot;distanceField&quot;: &quot;dist.calculated&quot;,&lt;br/&gt;
 &quot;maxDistance&quot;: &quot;max_travel_radius&quot;,&lt;br/&gt;
 &quot;key&quot;: &quot;address_geopoint&quot;,&lt;br/&gt;
 &quot;uniqueDocs&quot;: &quot;True&quot;&lt;br/&gt;
}&lt;/p&gt;</description>
                <environment></environment>
        <key id="1985256">SERVER-63756</key>
            <summary>maxDistance field on GeoNear query not accepting field number</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="edwin.zhou@mongodb.com">Edwin Zhou</assignee>
                                    <reporter username="rebekahmark12@gmail.com">Rebekah Mark</reporter>
                        <labels>
                            <label>geoNear</label>
                    </labels>
                <created>Thu, 17 Feb 2022 02:58:34 +0000</created>
                <updated>Fri, 27 Oct 2023 13:52:06 +0000</updated>
                            <resolved>Fri, 4 Mar 2022 17:07:04 +0000</resolved>
                                    <version>4.2 Required</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4391957" author="JIRAUSER1257066" created="Fri, 4 Mar 2022 17:06:55 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rebekahmark12%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;rebekahmark12@gmail.com&quot;&gt;rebekahmark12@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for your patience. I&apos;ve investigated this issue further and I believe this behavior Works as Designed. The $geoNear aggregation stage queries for documents near a given point, and the max distance filters out documents exceeding the specified distance. The maxDistance field is not intended to be defined with input documents and it wouldn&apos;t work with the use case you described. &lt;/p&gt;

&lt;p&gt;If you need further help troubleshooting, I recommend reaching out to our &lt;a href=&quot;https://community.mongodb.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Developer Community Forums&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Best,&lt;br/&gt;
Edwin&lt;/p&gt;</comment>
                            <comment id="4381392" author="JIRAUSER1264957" created="Mon, 28 Feb 2022 19:00:05 +0000"  >
&lt;p&gt;Thank you so much! Eagerly awaiting what you find.&lt;br/&gt;
Best,&lt;br/&gt;
Rebekah&lt;/p&gt;
</comment>
                            <comment id="4381256" author="JIRAUSER1257066" created="Mon, 28 Feb 2022 18:26:10 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rebekahmark12%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;rebekahmark12@gmail.com&quot;&gt;rebekahmark12@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for following up that you have already attempted to reference the field path with a $ prefix. I&apos;ve been able to reproduce this issue and will continue investigating.&lt;/p&gt;

&lt;p&gt;Best,&lt;br/&gt;
Edwin&lt;/p&gt;</comment>
                            <comment id="4380972" author="JIRAUSER1264957" created="Mon, 28 Feb 2022 17:15:07 +0000"  >
&lt;p&gt;If you follow the steps I listed to reproduce it will likely give you a&lt;br/&gt;
better idea as it will produce the same error.&lt;/p&gt;
</comment>
                            <comment id="4380970" author="JIRAUSER1264957" created="Mon, 28 Feb 2022 17:15:05 +0000"  >
&lt;p&gt;I would appreciate it if you could keep this issue open and not marked as&lt;br/&gt;
done as that solution does not currently work.&lt;/p&gt;
</comment>
                            <comment id="4380942" author="JIRAUSER1264957" created="Mon, 28 Feb 2022 17:10:05 +0000"  >
&lt;p&gt;Hi Edwin -&lt;br/&gt;
Thank you for reaching out. I have already tried referencing with a dollar&lt;br/&gt;
sign and it produces the same error. I can send you screenshots in just a&lt;br/&gt;
bit.&lt;/p&gt;

&lt;p&gt;Rebekah&lt;/p&gt;
</comment>
                            <comment id="4380908" author="JIRAUSER1257066" created="Mon, 28 Feb 2022 17:01:18 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rebekahmark12%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;rebekahmark12@gmail.com&quot;&gt;rebekahmark12@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for your report. Based on an initial look, it appears that in your aggregation pipeline, you&apos;re attempting to reference a &lt;a href=&quot;https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#field-paths&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;field path&lt;/a&gt;. When doing so, you must prefix the field path name with a dollar sign &lt;tt&gt;$&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;For this issue we&apos;d like to encourage you to start by asking our community for help by posting on the &lt;a href=&quot;https://community.mongodb.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Developer Community Forums&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If the discussion there leads you to suspect a bug in the MongoDB server, then we&apos;d want to investigate it as a possible bug here in the SERVER project.&lt;/p&gt;

&lt;p&gt;Best,&lt;br/&gt;
Edwin&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1985257">SERVER-63757</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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 28 Feb 2022 17:01:18 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 48 weeks, 5 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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 48 weeks, 5 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>edwin.zhou@mongodb.com</customfieldvalue>
            <customfieldvalue>rebekahmark12@gmail.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0ki13:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i03kg7:</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;1. Create any mongo document that includes a float or number field for the max travel radius, and an address field as points coordinates. Then try to pull the max travel radius field in for maxDistance, and the address field in for key (this part works fine when maxDistance is a hard coded number). Below is a basic example of the document structure.&#160;&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;&quot;_id&quot;:&quot;apitestuser&quot;,&lt;/p&gt;

&lt;p&gt;&quot;address_geopoint&quot;: &lt;/p&gt;
{

&#160; &#160; &#160;&quot;type&quot;:&quot;Point&quot;,&quot;coordinates&quot;: [-111.8905343,40.7661073]}
&lt;p&gt;,&lt;/p&gt;

&lt;p&gt;&quot;max_travel_radius&quot;:10.1&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

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

&lt;p&gt;2. Select the aggregation pipeline in Mongo Compass (I have tried running this same query in a python IDE and get the same result, so it&apos;s not a Mongo Compass specific bug) and choose GeoNear. Paste the following code in:&lt;/p&gt;

{
 &quot;near&quot;: \{type: &quot;Point&quot;, coordinates: [-111.887277, 40.770020]}
&lt;p&gt;,&lt;br/&gt;
 &quot;distanceField&quot;: &quot;dist.calculated&quot;,&lt;br/&gt;
 &quot;maxDistance&quot;: &quot;max_travel_radius&quot;,&lt;br/&gt;
 &quot;key&quot;: &quot;address_geopoint&quot;,&lt;br/&gt;
 &quot;uniqueDocs&quot;: &quot;True&quot;&lt;br/&gt;
}&lt;/p&gt;

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

&lt;p&gt;3. After the code is pasted it should automatically produce the error &apos;maxDistance must be a number&apos;.&lt;/p&gt;

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

&lt;p&gt;4. Change the maxDistance field from &quot;max_travel_radius&quot; to 3000 for testing purposes. It should run fine.&#160;&lt;/p&gt;

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

&lt;p&gt;I need this to pull in the document field and not require only the hard coded value, which from reading the documentation has led me to believe is possible and this is a bug.&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[edwin.zhou@mongodb.com]]></customfieldvalue>
    

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

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