<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:01 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-766] DBCollection.setReadReference() has no effect</title>
                <link>https://jira.mongodb.org/browse/JAVA-766</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I have a sharded MongoDB cluster which has 2 shards. Each shard has 1 primary node, 1 secondary node and 1 arbiter. The mongos runs on one of the cluster machines. &lt;br/&gt;
I use the following codes to connec to mongos:&lt;br/&gt;
        Mongo mongo = new Mongo(args&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;);&lt;br/&gt;
        DB emData = mongo.getDB(args&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;);&lt;br/&gt;
        DBCollection publicationMonth = emData.getCollection(args&lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;);&lt;br/&gt;
        publicationMonth.setReadPreference(ReadPreference.secondary());&lt;br/&gt;
However, when I execute an aggregation on the &quot;publicationMonth&quot; collection, only the primary nodes are busy to execute the query while the secondary nodes sitting there idle. &lt;/p&gt;

&lt;p&gt;If I modify above codes a little bit to:&lt;br/&gt;
        Mongo mongo = new Mongo(args&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;);&lt;br/&gt;
        mongo.setReadReference(ReadPreference.secondary());&lt;br/&gt;
        DB emData = mongo.getDB(args&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;);&lt;br/&gt;
        DBCollection publicationMonth = emData.getCollection(args&lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;);&lt;br/&gt;
secondary nodes will execute the aggregation query instead of primary nodes.&lt;/p&gt;</description>
                <environment>Server: MongoDB 2.2.3 x64 version running on CentOS 6.3&lt;br/&gt;
Client: Sun JDK 1.6.0_31 x64 versuion, running on CentOS 6.3</environment>
        <key id="65947">JAVA-766</key>
            <summary>DBCollection.setReadReference() has no effect</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="drowndog">Yibing Shi</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Feb 2013 05:06:59 +0000</created>
                <updated>Thu, 21 Feb 2013 22:40:06 +0000</updated>
                            <resolved>Thu, 21 Feb 2013 13:06:51 +0000</resolved>
                                    <version>2.10.1</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="272553" author="drowndog" created="Thu, 21 Feb 2013 22:40:06 +0000"  >&lt;p&gt;Sorry for not finding the duplicated topic! I did some search before reporting but neglected &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-705&quot; title=&quot;Query commands like aggregate and mapReduce don&amp;#39;t pick up the read preference set on the collection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-705&quot;&gt;&lt;del&gt;JAVA-705&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="272032" author="jeff.yemin" created="Thu, 21 Feb 2013 13:06:35 +0000"  >&lt;p&gt;Thanks for the report. I&apos;m linking it to a previous report of the same issue and closing this one out.  Please watch &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-705&quot; title=&quot;Query commands like aggregate and mapReduce don&amp;#39;t pick up the read preference set on the collection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-705&quot;&gt;&lt;del&gt;JAVA-705&lt;/del&gt;&lt;/a&gt; for progress.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="57970">JAVA-705</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hrmaaf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>43610</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>