<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:24:04 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-10789] User-Parameterized Views</title>
                <link>https://jira.mongodb.org/browse/SERVER-10789</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Supposing &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-10787&quot; title=&quot;Read-only views&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-10787&quot;&gt;&lt;del&gt;SERVER-10787&lt;/del&gt;&lt;/a&gt; and maybe &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-10788&quot; title=&quot;Writable views&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-10788&quot;&gt;SERVER-10788&lt;/a&gt;, it would be nice to define a view whose contents are dependent on properties of the authenticated user searching it.&lt;/p&gt;</description>
                <environment></environment>
        <key id="90095">SERVER-10789</key>
            <summary>User-Parameterized Views</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="9">Done</resolution>
                                        <assignee username="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="schwerin@mongodb.com">Andy Schwerin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Sep 2013 18:35:53 +0000</created>
                <updated>Wed, 21 Jun 2023 17:26:01 +0000</updated>
                            <resolved>Wed, 21 Jun 2023 17:26:00 +0000</resolved>
                                                    <fixVersion>7.0.0-rc0</fixVersion>
                                    <component>Usability</component>
                                        <votes>9</votes>
                                    <watches>23</watches>
                                                                                                                <comments>
                            <comment id="5516041" author="kateryna.kamenieva" created="Wed, 21 Jun 2023 17:26:01 +0000"  >&lt;p&gt;New system variable $$USER_ROLES returns roles of the current database user. A pipeline of the view definition can refer to this variable when expressing a condition for what data will be shown by the view.&lt;/p&gt;

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

&lt;p&gt;Re-opening ticket &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-45433&quot; title=&quot;Parameterized views&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-45433&quot;&gt;SERVER-45433&lt;/a&gt; to track support for user-defined variables in the view definition.&lt;/p&gt;</comment>
                            <comment id="5120696" author="brady.byrd" created="Wed, 18 Jan 2023 14:24:30 +0000"  >&lt;p&gt;I&apos;d really love to see this feature.&#160; I&apos;m finding that this capability is absolutely essential to make lookups and translated sql queries performant.&lt;/p&gt;

&lt;p&gt;db.createView(&quot;myView&quot;, &quot;myColl&quot;,&#160;[&lt;/p&gt;

&lt;p&gt;{$match : { mykey: {$parameter: &lt;/p&gt;
{type: &quot;string&quot;, default: &quot;&quot;}
&lt;p&gt;}},&lt;/p&gt;

&lt;p&gt;{$lookup : { from...}}&lt;/p&gt;

&lt;p&gt;]&lt;/p&gt;

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

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="4525691" author="JIRAUSER1268633" created="Wed, 4 May 2022 14:26:35 +0000"  >&lt;p&gt;Could you please expedite this passing parameter to Mongo view? Without this views are too slow and it is impacting our production system as the data grows in underlying collection, views are becoming too slow. We can filter data lot earlier in the pipeline if we get to pass value to matching parameter.&#160;&lt;/p&gt;

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

&lt;p&gt;Regards,&lt;/p&gt;

&lt;p&gt;Suvra&lt;/p&gt;</comment>
                            <comment id="3640756" author="JIRAUSER1269401" created="Mon, 1 Mar 2021 21:16:44 +0000"  >&lt;p&gt;We&apos;re keen on having parametrized views as well!&lt;/p&gt;</comment>
                            <comment id="2763012" author="kateryna.kamenieva" created="Fri, 24 Jan 2020 19:16:58 +0000"  >&lt;p&gt;Adding this request to backlog for prioritization.&lt;/p&gt;</comment>
                            <comment id="2105626" author="asya" created="Fri, 4 Jan 2019 16:18:36 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=sgaylord%40facilitron.com&quot; class=&quot;user-hover&quot; rel=&quot;sgaylord@facilitron.com&quot;&gt;sgaylord@facilitron.com&lt;/a&gt; if the view you created is not sharded you can run the aggregation in it with $out to create a collection with the results and then do a selective $lookup from that collection (using an indexed field to join).&lt;/p&gt;</comment>
                            <comment id="2105608" author="asya" created="Fri, 4 Jan 2019 16:12:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=sgaylord%40facilitron.com&quot; class=&quot;user-hover&quot; rel=&quot;sgaylord@facilitron.com&quot;&gt;sgaylord@facilitron.com&lt;/a&gt; I think what you are describing is being tracked by &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34741&quot; title=&quot;Move $match in front of $group if condition is on group key&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34741&quot;&gt;&lt;del&gt;SERVER-34741&lt;/del&gt;&lt;/a&gt; and it&apos;s not necessarily related to this ticket (though views that took parameters could be a workaround for this use case).&lt;/p&gt;</comment>
                            <comment id="2104412" author="sgaylord@facilitron.com" created="Thu, 3 Jan 2019 16:36:11 +0000"  >&lt;p&gt;Yes, we do have a group in the view.&#160; Let me give you more details of our use case.&#160; We have three collections, collection one has the parent document and collection two and three have child documents.&#160; I need to see the count of the documents in collection two and if that is zero I need the documents from collection three, so I created a view that looks at collection two and groups them for each parent document and then looks at collection three for those parents that do not have any child documents in collection two and then do a $project to get the appropriate array of documents from collection two or collection three.&#160;&lt;/p&gt;

&lt;p&gt;Then when I call an aggregate on the view or use it in a $lookup, I pass in the _id of the parent document I am looking for.&#160; But it looks like the view takes the $match I pass in the aggregate or $lookup and places it after the view pipeline so I get a collscan.&#160; Does that help define the use case?&#160;&#160;&lt;/p&gt;</comment>
                            <comment id="2103929" author="asya" created="Thu, 3 Jan 2019 00:41:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=sgaylord%40facilitron.com&quot; class=&quot;user-hover&quot; rel=&quot;sgaylord@facilitron.com&quot;&gt;sgaylord@facilitron.com&lt;/a&gt; aggregation pipeline has the ability to reorder stages to optimize the query plan it&apos;s able to use.&lt;/p&gt;

&lt;p&gt;Does your view involve $group (or similar) stage where you only want a subset of the results?&lt;/p&gt;</comment>
                            <comment id="2103545" author="sgaylord@facilitron.com" created="Wed, 2 Jan 2019 19:49:58 +0000"  >&lt;p&gt;We would like something like this as well.&#160;&lt;/p&gt;

&lt;p&gt;We would like to create the view but pass in the matching characteristics at run time, but currently that match is placed at the end of the pipeline.&#160;&lt;/p&gt;

&lt;p&gt;We have two collections and we want to pull data from one or the other for a specific entry passed in at runtime, so the view needs to be on the entire collection and then pass the match the specific entity at runtime.&#160; This causes the view to do a COLLSCAN when called.&lt;/p&gt;</comment>
                            <comment id="1989728" author="brunorenzo" created="Thu, 30 Aug 2018 12:11:00 +0000"  >&lt;p&gt;Hi Andy,&lt;/p&gt;

&lt;p&gt;You mean any given input parameter? If yes, that&apos;s exactly what I&apos;m looking for as well.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;A very simple aggregate to group information given a number of last days:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.collection.aggregate([&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    {$match: {created: {$gte: &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; Date((&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; Date().getTime() - (30 * 86400000)))}}},&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    {$group: {_id: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;$country&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;, totalDocs: {$sum: 1}}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;])&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;In this case, I would like to create a view that can receive as input parameter the number of days, so that I don&apos;t need to hard-code &quot;30&quot; in the $match.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="1082017">SERVER-45433</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="90093">SERVER-10787</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="234744">SERVER-20968</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>11.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000ZMu0dIAD, 5002K00000d6GocQAE, 5002K00000d5iU1QAI, 5002K00000plp8IQAQ, 5002K00000s0YmgQAE, 5002K00000uFeZgQAK, 5006R00001l9IyVQAU]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 30 Aug 2018 12:11:00 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        33 weeks 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </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>kateryna.kamenieva@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            33 weeks 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>ataramina@shorecg.com</customfieldvalue>
            <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>brady.byrd@mongodb.com</customfieldvalue>
            <customfieldvalue>brunorenzo</customfieldvalue>
            <customfieldvalue>kateryna.kamenieva@mongodb.com</customfieldvalue>
            <customfieldvalue>sgaylord@facilitron.com</customfieldvalue>
            <customfieldvalue>suvra.banerjee@cmegroup.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmgfb:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4471</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_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></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>
                                

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

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