<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:40 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-602] Setting ReadPreference.PRIMARY on a find has no effect if slaveOk=true has been set in the connection string</title>
                <link>https://jira.mongodb.org/browse/JAVA-602</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;When the connection string contains slaveOk=true as an option then the following line of (groovy) code may read from a secondary server in a replica set:&lt;/p&gt;

&lt;p&gt;collection.findOne(new BasicDBObject(&lt;span class=&quot;error&quot;&gt;&amp;#91;_id: key&amp;#93;&lt;/span&gt;),null, ReadPreference.PRIMARY)&lt;/p&gt;

&lt;p&gt;I believe that this may well affect all find methods.&lt;/p&gt;

&lt;p&gt;This appears to be due to the code in OutMethod.appendQuery() which ORs in Bytes.QUERYOPTION_SLAVEOK if the read preference is NOT primary but does nothing if the read preference is primary.&lt;/p&gt;</description>
                <environment></environment>
        <key id="44128">JAVA-602</key>
            <summary>Setting ReadPreference.PRIMARY on a find has no effect if slaveOk=true has been set in the connection string</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="chris@barrett-consulting.co.uk">Chris Barrett</reporter>
                        <labels>
                            <label>connection</label>
                            <label>java</label>
                            <label>replicaset</label>
                    </labels>
                <created>Fri, 13 Jul 2012 15:36:22 +0000</created>
                <updated>Sun, 12 Aug 2012 03:59:36 +0000</updated>
                            <resolved>Sun, 12 Aug 2012 03:59:14 +0000</resolved>
                                    <version>2.7.3</version>
                                                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="152588" author="jeff.yemin" created="Sun, 12 Aug 2012 03:58:55 +0000"  >&lt;p&gt;In 2.9.0 you can specify read preference in the connection string.&lt;/p&gt;</comment>
                            <comment id="142866" author="chris@barrett-consulting.co.uk" created="Fri, 13 Jul 2012 18:26:57 +0000"  >&lt;p&gt;No problem.&lt;/p&gt;

&lt;p&gt;Chris.&lt;/p&gt;
</comment>
                            <comment id="142810" author="jeff.yemin" created="Fri, 13 Jul 2012 17:03:14 +0000"  >&lt;p&gt;Chris,&lt;/p&gt;

&lt;p&gt;Thinking about this a bit more, I&apos;m not convinced it&apos;s a bug.  Read preferences supercedes slaveOk (slaveOk is now deprecated), so the idea is that applications should use one or the other, but not both.  I think what we&apos;ll be doing soon is to allow you to set the default read preference in the connection string, and then it should work properly if you use that.&lt;/p&gt;</comment>
                            <comment id="142797" author="jeff.yemin" created="Fri, 13 Jul 2012 16:30:07 +0000"  >&lt;p&gt;Chris, let&apos;s hold off on that since we have some code in flight that&apos;s not yet pushed.  Thanks for the offer though. Ordinarily we welcome pull requests.&lt;/p&gt;</comment>
                            <comment id="142792" author="chris@barrett-consulting.co.uk" created="Fri, 13 Jul 2012 16:22:46 +0000"  >&lt;p&gt;Thanks for responding. If it helps I&apos;m happy to look into it to see I&apos;d I&lt;br/&gt;
can patch it easily and send that over. Let me know if that would be&lt;br/&gt;
helpful.&lt;/p&gt;

&lt;p&gt;Chris&lt;/p&gt;
</comment>
                            <comment id="142783" author="jeff.yemin" created="Fri, 13 Jul 2012 15:46:16 +0000"  >&lt;p&gt;Thanks for the report.  We&apos;re doing some work on read preferences in 2.9.0 and perhaps will be able to address this as part of it.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="25162">JAVA-474</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|hrhb07:</customfieldvalue>

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