I don't see the value on calling `$d->setReadPreference()`, since you're going to overwrite `$d` and `$c` in the following lines.