Introduction
Reading from secondary servers helps spread out the work and can make your app faster, but it might show data that is a little old.
db.collection.find().readPref('secondary')db.users.find().readPref('secondary')db.orders.find().readPref('secondaryPreferred')db.products.find().readPref('primary')use shopDB // Read product list from secondary to reduce load const products = db.products.find().readPref('secondary').toArray() printjson(products)
secondary, what is the most likely outcome?readPreference: 'secondary', but your application sometimes gets errors when no secondaries are available. How can you fix this?Pass the test and this pattern moves unknown