-
Type: Spec Change
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Component/s: Transactions
-
None
-
Needed
The transactions spec has the following rules for read preferences and runCommand in a transaction:
1. Note that the readPreference property is optional. The default value is NULL. If readPreference is NULL the value will be inherited from this session’s defaultTransactionOptions. If defaultTransactionOptions itself is NULL or the readPreference in defaultTransactionOptions is NULL, the readPreference is inherited from the MongoClient associated with this session.
2. The transaction’s read preference MUST override all other user configurable read preferences, with the exception of drivers that allow an operation level read preference. In this case, the driver MUST respect the read preference specified by the user, allowing the server to report an error.
3. The RunCommand method is considered a read operation and MUST use the transaction’s read preference.
Points 2 and 3 cause an issue for the "run command fails with explicit secondary read preference" for drivers that allow specifying a read preference for runCommand. If 2 is followed, the test passes but if 3 is followed, the operation will default to the client's read preference (primary) and there will be no error.