<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:59:07 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-2150] Persistent Queries</title>
                <link>https://jira.mongodb.org/browse/SERVER-2150</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Let&apos;s say we have this query which returns all the documents in the collection &apos;users&apos; where &apos;last_name&apos; field has the value &apos;Smith&apos;: &lt;/p&gt;

&lt;p&gt;BasicDBObject query = new BasicDBObject(); &lt;br/&gt;
query.put(&quot;last_name&quot;, &quot;Smith&quot;); &lt;br/&gt;
DBCursor cursor = users.find(query); &lt;br/&gt;
while(cursor.hasNext()) { &lt;br/&gt;
    System.out.println(cursor.next()); &lt;br/&gt;
} &lt;/p&gt;

&lt;p&gt;We might be interested in monitoring if the results of the above query change. At the moment the only solution is to periodically run the query again and decide the application level if something changes. This model is very ineffective if there are many clients.&lt;/p&gt;

&lt;p&gt;The solution I suggest is to implement &quot;Persistent Queries&quot;, a feature which is usually found in directory servers (Active Directory, OpenDS, etc.). We should be able to register  a listener for a given query and whenever the results of a query changed (ideal case) or might have changed (would be a signal at least) we should be notified.&lt;/p&gt;

&lt;p&gt;The listener should be notified with the cursor (might be too much) or at least with the signal that something might have changed with the results of the query (and the client applications would decide if and when to re-query). The signal might be a light solution and if changes are frequent the client canned decide not to re-run the query on every signal.&lt;/p&gt;

&lt;p&gt;As syntax, for the Java driver, might be: &lt;/p&gt;

&lt;p&gt;listener = new QueryListener() { &lt;br/&gt;
    public void resultChanged(BasicDBObject query, DBCursor cursor) &lt;/p&gt;
{ 
        ... 
    }
&lt;p&gt; &lt;br/&gt;
} &lt;br/&gt;
users.addQueryListener(query, listener) &lt;/p&gt;

&lt;p&gt;I&apos;m not sure about how widespread is the need for something like this and I&apos;m not sure what are the implementation complexities, but definitely at server level there is the most knowledge about when query might have been affected by a change.&lt;/p&gt;

&lt;p&gt;Definitely is not something to use when results might be large, we would not do repeated pooling either for large results. But might be very useful when the results are relatively small, change infrequent but is important to know when they changed. &lt;/p&gt;

&lt;p&gt;I would definitely find good use for something like this since subscription based models tend to be more efficient. &lt;/p&gt;</description>
                <environment></environment>
        <key id="13804">SERVER-2150</key>
            <summary>Persistent Queries</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="3">Duplicate</resolution>
                                        <assignee username="backlog-server-query">Backlog - Query Team</assignee>
                                    <reporter username="alex.turc">Alexandru Ioan Turc</reporter>
                        <labels>
                    </labels>
                <created>Fri, 26 Nov 2010 08:06:04 +0000</created>
                <updated>Tue, 6 Dec 2022 05:46:56 +0000</updated>
                            <resolved>Mon, 17 Dec 2018 21:05:02 +0000</resolved>
                                                                    <component>Querying</component>
                                        <votes>4</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="2093475" author="asya" created="Mon, 17 Dec 2018 21:05:02 +0000"  >&lt;p&gt;Because &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31720&quot; title=&quot;Provide a way to get notification when results of a query change&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31720&quot;&gt;SERVER-31720&lt;/a&gt; has more current description of functionality this ticket is describing, I&apos;m closing this ticket in favor of the later one rather than the other way around.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="346113">SERVER-27698</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="136339">SERVER-13932</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="451102">SERVER-31720</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="643157">SERVER-38401</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>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25143"><![CDATA[Query]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 4 Dec 2017 19:36:37 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 8 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-13932'>SERVER-13932</a></s>, <a href='https://jira.mongodb.org/browse/SERVER-27698'>SERVER-27698</a>]]></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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 8 weeks, 2 days 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>alex.turc</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-query</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpavz:</customfieldvalue>

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

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

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

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