Reputation: 639
connection:
client = MongoClient(
'localhost:27017',
replicaSet='foo',
readPreference='secondaryPreferred')
so, how to specify whether slave or master is used ? thanks~
Upvotes: 0
Views: 50
Reputation: 330083
You can set readPreference
to either primary
or secondary
if you want to limit to the specific category. If need more granular control you can use tagSet
to limit the options.
To use the tag sets you have to:
readPref
based on tag or use setReadPref
on Mongo connectionUpvotes: 1