[CSHARP-1159] RunCommand should default to Primary ReadPreference Created: 08/Jan/15  Updated: 02/Apr/15  Resolved: 12/Jan/15

Status: Closed
Project: C# Driver
Component/s: Operations
Affects Version/s: None
Fix Version/s: 2.0

Type: Task Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change

 Description   

Drivers in general are changing how ReadPreference is used with the generic RunCommand helper method. In particular:

1. RunCommand should default to Primary (not the ReadPreference in the database settings)
2. RunCommand should have an overload allowing the user to specify a ReadPreference if desired

This is slightly backward compatible in the sense that commands that might have been sent to a secondary before will now be sent to the primary (unless you change your code to explicitly specify a ReadPreference when calling RunCommand).



 Comments   
Comment by Robert Stam [ 12/Jan/15 ]

We have only made this change for the 2.0 driver.

In the 1.10 driver will RunCommand will remain unchanged.

Comment by Githook User [ 12/Jan/15 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1159: Make the overload of RunCommandAs that takes a ReadPreference public.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/8f3f7e85bfa372b746e9ce3d7c866a0ffe92d566

Comment by Githook User [ 12/Jan/15 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1159: RunCommand should default to Primary ReadPreference in legacy API also.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/d694141e3f146b08a6da2da5bb6f80a931afe0b0

Comment by Githook User [ 12/Jan/15 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1159: Remove enforcement of which commands can be sent to a secondary from Core.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/466986497e7eaf6c08bfa1d41ae3fb34ffdd69d9

Comment by Githook User [ 12/Jan/15 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1159: RunCommand should default to Primary ReadPreference.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/a297d2c6e467a9707c41b013ca9d6b300689ab02

Generated at Wed Feb 07 21:38:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.