<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:15:56 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-27698] Materialized Views</title>
                <link>https://jira.mongodb.org/browse/SERVER-27698</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Materialized views would allow developers that use MongoDB to move data denormalization from the application layer to the database layer. While the process of materializing the view will require additional writes and slow the effective throughput of the database per write request, if used properly it should be a net wash in terms of real world performance as applications will not be sending additional requests to write the same denormalized data.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;ProposedCommand&quot;&gt;&lt;/a&gt;Proposed Command&lt;/h3&gt;

&lt;p&gt;A simple expansion of the command for creating a view. A new materialized: &amp;lt;bool&amp;gt; option which defaults to false would allow the view to be created as a materialized view:&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;   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;db.runCommand( { create: &amp;lt;view&amp;gt;, viewOn: &amp;lt;source&amp;gt;, pipeline: &amp;lt;pipeline&amp;gt;, materialized: &amp;lt;bool&amp;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;h3&gt;&lt;a name=&quot;ProposedBehavior&quot;&gt;&lt;/a&gt;Proposed Behavior&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;Materialized views exist on disk but cannot be written to by the user. Internally a materialized view is a normal collection that is maintained by MongoDB using a defined pipeline rather than maintained by writes from an application.&lt;/li&gt;
	&lt;li&gt;Updates to the materialized view are not atomic. In other words, queries against the collection(s) that back(s) a materialized view may return results that are inconsistent with the results of the materialized view.&lt;/li&gt;
	&lt;li&gt;Materialized views do not use the indexes or sharding of the underlying collection(s)&lt;/li&gt;
	&lt;li&gt;Materialized views can be indexed and/or sharded like a normal collection&lt;/li&gt;
	&lt;li&gt;The aggregation pipline for a materialized view must emit an _id&lt;/li&gt;
	&lt;li&gt;Materialized views write the result of the pipeline as an upsert against _id&lt;/li&gt;
	&lt;li&gt;When updating a document in the underlying collection the pipeline will only be run against the document being updated. To ensure correct results materialized views should only use operators that can properly work against a single document. Materialized views typically should not use pipeline stages that operate against a set of documents such as:&lt;/li&gt;
	&lt;li&gt;$limit&lt;/li&gt;
	&lt;li&gt;$skip&lt;/li&gt;
	&lt;li&gt;$group&lt;/li&gt;
	&lt;li&gt;$sample&lt;/li&gt;
	&lt;li&gt;$sort&lt;/li&gt;
	&lt;li&gt;$out&lt;/li&gt;
	&lt;li&gt;$bucket&lt;/li&gt;
	&lt;li&gt;$bucketAuto&lt;/li&gt;
	&lt;li&gt;$sortByCount&lt;/li&gt;
	&lt;li&gt;$count&lt;/li&gt;
	&lt;li&gt;The database should not enforce any limitation on the above commands because they may still be useful in connection with other stages such as $unwind.&lt;/li&gt;
	&lt;li&gt;Materialized views may use $lookup, however, updates against the joined collection will not update associated documents in the materialized view. Applications may force an update of associated materialized documents by forcing an update of the appropriate backing documents in the collection that the materialized view is based on.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;&lt;a name=&quot;OtherConsiderations&quot;&gt;&lt;/a&gt;Other Considerations&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;It seems that the ability to update the definition of a materialized view would be extremely desirable, however, this could also be a monumentally expensive operation during which data on the collection would be in an inconsistent state. Ensuring consistency doubles the space requirements. If updates to the definition are allowed, it might make sense to allow the user to choose between consistency or an in-place strategy (inPlace: &amp;lt;bool&amp;gt;, default false).&lt;/li&gt;
	&lt;li&gt;I&apos;m not sure how to handle the $match stage, especially in the case where a record matched, and so was materialized, and later does not match, and should be removed. The simplistic implementation could simply dictate that match is bad, and you should emit an empty record instead, but that seems messy. It may be that materialized views require an extra internal collection of some sort to store the relationships between the input document(s) and the output record(s). Such a collection might conceivably also be useful for allowing a strong materialization of records pulled in from $lookup.&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="346113">SERVER-27698</key>
            <summary>Materialized 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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-execution">Backlog - Query Execution</assignee>
                                    <reporter username="bugslayer">John Crenshaw</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Jan 2017 23:43:07 +0000</created>
                <updated>Tue, 6 Dec 2022 04:07:54 +0000</updated>
                                                                            <component>Usability</component>
                                        <votes>28</votes>
                                    <watches>49</watches>
                                                                                                                <comments>
                            <comment id="3346051" author="dan@10gen.com" created="Tue, 18 Aug 2020 22:02:17 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=marcelnsquaredsoftware%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;marcelnsquaredsoftware@gmail.com&quot;&gt;marcelnsquaredsoftware@gmail.com&lt;/a&gt;, I wonder if using a pattern of &quot;&lt;a href=&quot;https://docs.mongodb.com/manual/core/materialized-views/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;on-demand materialized views&lt;/a&gt;&quot; (which leverages the $merge functionality released in v4.2) would apply to your use case.&lt;/p&gt;</comment>
                            <comment id="3346029" author="JIRAUSER1255754" created="Tue, 18 Aug 2020 21:38:33 +0000"  >&lt;p&gt;+1 to this. Not being able to do an SQL equivalent materialised view makes dealing with datasets spanning millions of records a real issue especially when we are dealing with down stream clients having to wait for complex aggregate queries to complete on large data sets (or even hit HTTP timeouts due to the query taking too long).&lt;/p&gt;

&lt;p&gt;In cases where 100% accuracy isn&apos;t required being able to instantly query even old data would be preferable if the result returned near instantaneously.&lt;/p&gt;

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

&lt;p&gt;M.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2098042" author="ravi.kumar.nagireddy@morganstanley.com" created="Fri, 21 Dec 2018 04:42:14 +0000"  >&lt;p&gt;&#65279;Thank you.&lt;br/&gt;
If it was implemented it would be good and helps developers a lot.&lt;/p&gt;

&lt;p&gt;Ravi Kumar Nagireddygari   &lt;br/&gt;
Morgan Stanley | Corporate &amp;amp; Funding Technology   &lt;br/&gt;
7-8/F, Campus 6A, RMZ Ecoworld, Sarjapur | Marathahalli Outer Ring Rd, Devarabisana Halli, Bengaluru East Taluk   &lt;br/&gt;
Bengaluru, 560103   &lt;br/&gt;
Phone: +91 80 6104-2021   &lt;br/&gt;
Mobile: +91 7 7022-22170   &lt;br/&gt;
Ravi.Kumar.Nagireddy@morganstanley.com   &lt;/p&gt;


&lt;p&gt;Be carbon conscious. Please consider our environment before printing this email.    &lt;/p&gt;
</comment>
                            <comment id="2097153" author="ramon.fernandez" created="Thu, 20 Dec 2018 15:43:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ravi.kumar.nagireddy%40morganstanley.com&quot; class=&quot;user-hover&quot; rel=&quot;ravi.kumar.nagireddy@morganstanley.com&quot;&gt;ravi.kumar.nagireddy@morganstanley.com&lt;/a&gt;, this feature is in our backlog but unfortunately there&apos;s no concrete timeline for it at the moment. We&apos;ll post updates to this ticket as that changes in the future.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                            <comment id="2088091" author="ravi.kumar.nagireddy@morganstanley.com" created="Wed, 12 Dec 2018 07:31:39 +0000"  >&lt;p&gt;Is there a timeline when&#160;this feature would be available?&lt;/p&gt;</comment>
                            <comment id="1478240" author="mark.agarunov" created="Tue, 17 Jan 2017 18:02:50 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bugslayer&quot; class=&quot;user-hover&quot; rel=&quot;bugslayer&quot;&gt;bugslayer&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for the detailed example. I&apos;ve set the fixVersion to &quot;Needs Triage&quot; for this new feature to be scheduled against our currently planned work. Updates will be posted on this ticket as they happen.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Mark&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                                        </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="13804">SERVER-2150</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="90094">SERVER-10788</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>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25125"><![CDATA[Query Execution]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000aNnozIAC, 5002K00000d5iU1QAI, 5002K00000dWflsQAC]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 17 Jan 2017 18:02:50 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 25 weeks, 1 day ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<a href='https://jira.mongodb.org/browse/PM-764'>PM-764</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>
                            3 years, 25 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-query-execution</customfieldvalue>
            <customfieldvalue>dan@mongodb.com</customfieldvalue>
            <customfieldvalue>bugslayer</customfieldvalue>
            <customfieldvalue>marcelnsquaredsoftware@gmail.com</customfieldvalue>
            <customfieldvalue>mark.agarunov</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
            <customfieldvalue>ravi.kumar.nagireddy@morganstanley.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|ht122f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr24sf:</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_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|hs4j2f:</customfieldvalue>

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