Complete the code to read from secondary nodes in MongoDB.
db.collection.find().readPref('[1]')
Using secondary as the read preference directs reads to secondary nodes.
Complete the code to set read preference to secondary with a tag in MongoDB.
db.collection.find().readPref('[1]', [{ region: 'us-east' }])
Setting read preference to secondary with tags reads from secondaries matching the tag.
Fix the error in the read preference setting to read from secondaries.
db.collection.find().readPref('[1]')
The correct read preference to read only from secondaries is secondary.
Fill both blanks to read from secondaries with a max staleness of 90 seconds.
db.collection.find().readPref('[1]', [], { maxStalenessSeconds: [2] })
Setting read preference to secondary with maxStalenessSeconds limits how stale the data can be.
Fill all three blanks to read from secondaries with tag 'dc:west' and max staleness 120 seconds.
db.collection.find().readPref('[1]', [[2]], { maxStalenessSeconds: [3] })
This sets the read preference to secondary, filters secondaries by the tag dc:west, and limits staleness to 120 seconds.