<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:02:06 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-4444] Support user contexts in the encoder / decoder contexts</title>
                <link>https://jira.mongodb.org/browse/JAVA-4444</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;See: PR: &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/846&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/846&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;I would like to discuss adding something like this to the DecoderContext. This would allow me to attach a cache in Morphia so that when I&apos;m fetching referenced documents, I can cache them and reuse the hydrated objects rather than reprocessing them all over and over. The precise shape of this API could no doubt use some fine tuning but this is the general idea.&lt;/p&gt;&lt;/blockquote&gt;</description>
                <environment></environment>
        <key id="1964070">JAVA-4444</key>
            <summary>Support user contexts in the encoder / decoder contexts</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="13203">Gone away</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="ross@mongodb.com">Ross Lawley</reporter>
                        <labels>
                    </labels>
                <created>Fri, 14 Jan 2022 09:40:51 +0000</created>
                <updated>Fri, 27 Oct 2023 19:48:31 +0000</updated>
                            <resolved>Wed, 2 Feb 2022 12:00:28 +0000</resolved>
                                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4329894" author="dbeng-pm-bot" created="Wed, 2 Feb 2022 12:00:29 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="4299157" author="jlee@antwerkz.com" created="Tue, 18 Jan 2022 22:40:39 +0000"  >&lt;p&gt;I&apos;m not sure I would agree at this point.&#160; If I have to go the route of opening and closing a cache around a query/aggregation, there&apos;s no immediate need to tie that to the DecoderContext necessarily.&#160; I can just use a simple Service Lookup pattern to find that cache.&#160; That still leaves the case of tracking the type of a query/aggregation for resolving source types but maybe I don&apos;t &lt;b&gt;really&lt;/b&gt; need those.&#160; Let me play with that cache idea and we&apos;ll circle back to this one.&lt;/p&gt;</comment>
                            <comment id="4299132" author="jeff.yemin" created="Tue, 18 Jan 2022 22:31:39 +0000"  >&lt;p&gt;I don&apos;t have any bright ideas here, but it sounds like the particular change requested here is not going to accomplish your goal.  Would you agree?  And if so, I suggest we close this and open a new ticket if you can think of a different driver enhancement that would help.&lt;/p&gt;</comment>
                            <comment id="4293181" author="jlee@antwerkz.com" created="Fri, 14 Jan 2022 15:33:30 +0000"  >&lt;p&gt;When loading a reference, I would like consult/update a cache so that a referenced document is only loaded the once.&#160; Among other things, this would enable circular references (there was a recent bug report about that) but would also obviously reduce the amount of processing in general.&#160; So when decoding a document and I encounter a referenced entity, I can begin to cache those to short circuit any further references in the results.&lt;/p&gt;

&lt;p&gt;Now, if the context gets recreated with each document in the result set, that poses a problem.&#160; I suppose the simplest, and therefore probably the wrong, answer is to use a ThreadLocal cache to wrap the decoding in a transaction-like boundary.&#160; e.g., in Morphia, I would register the cache in a ThreadLocal, execute the query/aggregation, and then deregister that cache to avoid reference leaks.&#160; A little less ideal but still tenable.&lt;/p&gt;

&lt;p&gt;Having this capability would also allow me to register the source type of an aggregation, say, to track mapping information for querying against references so that I know how to/if i need to encoded comparison values for those properties.&lt;/p&gt;</comment>
                            <comment id="4292858" author="jeff.yemin" created="Fri, 14 Jan 2022 13:15:22 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=justin.lee&quot; class=&quot;user-hover&quot; rel=&quot;justin.lee&quot;&gt;justin.lee&lt;/a&gt;&#160;&lt;/p&gt;

&lt;p&gt;Can you explain a bit how Morphia would make use this API?&#160; Since DecoderContext instances are &lt;a href=&quot;#L51],&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;created anew by the driver for each document being decoded&lt;/a&gt;&#160;how would Morphia take advantage of attachments that were added to a single instance of DecoderContext?&lt;/p&gt;

&lt;p&gt;It seems that any cache would have to be either a global, or configured at the level of MongoClient.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr3mwv:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>