Describe the bug
For architectural reasons, I need to update the readPreference for a given method, on a given repository at the fly.
Please note, this change should be done at real time, and impact only this function invocation. However, the readPreferrence at the application level/datasource level should remain intact to "primaryPreferred".
For example,
this.userRepo.find(filter, { readPreference: "secondary" }); // request is still going to primary MongoDB server!
this.userRepo.findById(filter, { readPreference: "primary" });
I've tried this, but upon checking mongodb logs, this does not seem to work. All the request are going to primary server.
MongoDB version: v4.2
Logs
Additional information
NA
Reproduction
https://github.com/shivambmgupta/loopback-next/tree/bug/read-preference-update