<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:15 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-862] DBCollection.find doesn&apos;t use custom DBEncoder to encode query</title>
                <link>https://jira.mongodb.org/browse/JAVA-862</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;&lt;tt&gt;DBApiLayer.__find&lt;/tt&gt; (&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/r2.11.2/src/main/com/mongodb/DBApiLayer.java#L273&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;DBApiLayer.java:273&lt;/a&gt;) references the global &lt;tt&gt;DefaultDBEncoder.FACTORY&lt;/tt&gt; instance, instead of using the collection&apos;s own custom encoder. This makes it impossible to pervasively use more than one encoder per process. We use a custom Scala wrapper, and this could cause us serious problems. Hopefully it&apos;s an easy fix. Thanks.&lt;/p&gt;</description>
                <environment></environment>
        <key id="80630">JAVA-862</key>
            <summary>DBCollection.find doesn&apos;t use custom DBEncoder to encode query</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="c9r">Chris Sachs</reporter>
                        <labels>
                            <label>bson</label>
                            <label>driver</label>
                            <label>query</label>
                    </labels>
                <created>Fri, 28 Jun 2013 03:07:18 +0000</created>
                <updated>Thu, 13 Nov 2014 22:41:43 +0000</updated>
                            <resolved>Thu, 13 Nov 2014 22:41:43 +0000</resolved>
                                    <version>2.10.1</version>
                    <version>2.11.2</version>
                                                    <component>API</component>
                    <component>Query Operations</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="763921" author="jeff.yemin" created="Thu, 13 Nov 2014 22:41:43 +0000"  >&lt;p&gt;Resolving as duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1215&quot; title=&quot;Implement new API for all queries and updates&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1215&quot;&gt;&lt;del&gt;JAVA-1215&lt;/del&gt;&lt;/a&gt;.  The new CRUD API accepts Object parameters for all query filters (and pretty much everything else as well), and so long as you&apos;ve registered a Codec in the CodecRegistry (configured in MongoClientOptions.codecRegistry), the driver will use that Codec to encode the object.&lt;/p&gt;

&lt;p&gt;Please let me know if you have any further questions.&lt;/p&gt;</comment>
                            <comment id="677514" author="jeff.yemin" created="Thu, 31 Jul 2014 14:06:06 +0000"  >&lt;p&gt;We should take this into consideration when designing API in scope of &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1215&quot; title=&quot;Implement new API for all queries and updates&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1215&quot;&gt;&lt;del&gt;JAVA-1215&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="371818" author="jeff.yemin" created="Mon, 1 Jul 2013 17:30:45 +0000"  >&lt;p&gt;Yes, the signature for Database.getCollection is something like:&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;   &amp;lt;T&amp;gt; MongoCollection&amp;lt;T&amp;gt; getCollection(String name, Codec&amp;lt;T&amp;gt; codec);&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;where &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;  interface Codec&amp;lt;T&amp;gt; implements Decoder&amp;lt;T&amp;gt;, Encoder&amp;lt;T&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;</comment>
                            <comment id="371814" author="c9r" created="Mon, 1 Jul 2013 17:27:12 +0000"  >&lt;p&gt;I see. Providing the encoder as an extra parameter would be an ideal solution from my perspective. I much prefer passing things like encoders on the stack over maintaining internal state in a DBCollection.&lt;/p&gt;

&lt;p&gt;The &lt;tt&gt;Encoder&amp;lt;F&amp;gt;&lt;/tt&gt; you postulated would exactly be a typeclass! Though for a strongly typed MongoCollection, providing the encoder to the constructor might be preferable.&lt;/p&gt;</comment>
                            <comment id="371795" author="jeff.yemin" created="Mon, 1 Jul 2013 17:12:27 +0000"  >&lt;p&gt;In 3.0 API, query filters/sort criteria are encoded in the standard way.  In principle, it wouldn&apos;t be too hard to change it.  The problem is more the API.  Currently we have something like this:&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;  public interface MongoCollection&amp;lt;T&amp;gt; {&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;     ... find(Document filter);&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;     T findOne(...);&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;     void insert(T document)&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;so MongoCollection is generic, so you can do something like:&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;   MongoCollection&amp;lt;UserProfile&amp;gt; collection = database.getCollection(...);&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;   collection.find(new Document(...));&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;We don&apos;t want the find method parameterized on the same type, but I could see something like this working:&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;  public interface MongoCollection&amp;lt;T&amp;gt; {&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;     &amp;lt;F&amp;gt; ... find(F filter, Encoder&amp;lt;F&amp;gt; encoder);&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;     T findOne(...);&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;     void insert(T document)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;



</comment>
                            <comment id="371745" author="c9r" created="Mon, 1 Jul 2013 16:20:31 +0000"  >&lt;p&gt;Great news. Yes, we were encoding BSON queries using our custom DBObject implementation.&lt;/p&gt;

&lt;p&gt;Our BSON implementation builds on an immutable object graph. We can quickly calculate BSON object sizes and write BSON straight to a plain OutputStream&#8211;no seeking necessary to overwrite the object size field. Do you currently encode queries in the standard way you do to avoid using an intermediate OutputBuffer?&lt;/p&gt;</comment>
                            <comment id="371625" author="uladzimir_mihura@epam.com" created="Mon, 1 Jul 2013 14:36:28 +0000"  >&lt;p&gt;Chris, &lt;/p&gt;

&lt;p&gt;Actually queries are the same bson as documents you are reading and writing. The difference in the extensibility - you can change the process of encoding and decoding documents, but this is not true for queries. They are encoded in a standard way and sent to socket.&lt;/p&gt;

&lt;p&gt;-vova&lt;/p&gt;</comment>
                            <comment id="370335" author="c9r" created="Fri, 28 Jun 2013 20:19:56 +0000"  >&lt;p&gt;Thanks for the quick and helpful reply. After looking through the code a bit more, I see that the driver transforms queries internally and doesn&apos;t just spit them out to the database socket.&lt;/p&gt;

&lt;p&gt;We use an abstract intermediate representation to stream large datasets though a web API in various formats with minimal transformation. We thought it would be convenient to represent queries this way too, since we already have the infrastructure in place.&lt;/p&gt;

&lt;p&gt;We worked around the problem by recursively transforming our internal representation to generic Java types for queries only. This is an acceptable solution since query objects are small. I understand if this bug is a won&apos;t fix.&lt;/p&gt;

&lt;p&gt;I think I just desire a native Scala mongo driver. One that uses typeclasses to serialize arbitrary types instead of a whole bunch of reflection-foo. I&apos;ve considered doing this myself, and the wire protocol looks super straightforward. But the &quot;out of date&quot; messages all over the docs gives me pause.&lt;/p&gt;</comment>
                            <comment id="369924" author="uladzimir_mihura@epam.com" created="Fri, 28 Jun 2013 13:54:10 +0000"  >&lt;p&gt;Chris, &lt;/p&gt;

&lt;p&gt;Using collection&apos;s own encoder for a queries is not entirely correct. Custom encoders and decoders are used only while you are dealing with objects from collection (encoding objects to be written, decode objects on read).&lt;/p&gt;

&lt;p&gt;Can you please clarify what you mean under &apos;pervasively use more than one encoder per process&apos; ?&lt;/p&gt;

&lt;p&gt;-vova&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="136195">JAVA-1215</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hrg9w7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8500</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="161">Sprint 2 - May 5 - May 23</customfieldvalue>

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