Hello guys.
I have a question regarding read preference in a transaction.
Why can’t read preference be secondary when executing a transaction?
I noticed in the documentation that it should be set the ‘primary’ read preference.
In my code I tried to run the transaction with read preference ‘secondary’ to see the result.
The result was the following exception:
com.mongodb.MongoClientException: Read preference in a transaction must be primary
Why does it happen ? Why does it always need to be ‘primary’ in a transaction?
Regards,
Caio