lithium
lithium copied to clipboard
Allow Mongo ReadPref on Individual Method Calls
It would be useful to allow the setting of Mongo readPreferences on individual method calls. Currently, we can only override the readPreference on the connection which limits flexibility. The proposal is to allow something like:
$conditions = ['old' => true]; $readPref = ['secondary', [['dc' => 'north']]]; $oldBooks = Books::all(compact('conditions', 'readPref'));
The ultimate solution will be to allow readPreferences to be set on connection, database, collection and method call.