All command queries through the PHP driver are currently directed to primary servers. We have several old tickets related to this, originating with requests to direct count commands to secondaries, but it was a non-trivial change that requiring checking the command against a whitelist to ensure it is read-only. The current ticket tracking this fix is PHP-535, which I linked to the issue you opened, PHP-662.
If you need an immediate work-around, you can call find()
on the $cmd
collection directly, passing the same $command
array argument that you'd typically pass to MongoDB::command()
as the argument to find()
. Kristina documented this solution in this JIRA comment, and although she used slaveOkay()
in that example, it should also work with read preferences.