Make MongoClient prefer secondaries
This commit is contained in:
parent
7797eb9210
commit
cfcd17d45e
@ -15,8 +15,10 @@ const pipeline = [];
|
||||
const PORT = process.env.PORT || 3002;
|
||||
|
||||
// Create Mongo client
|
||||
const mongoClient = new MongoClient(mongoUri);
|
||||
|
||||
const mongoOptions = {
|
||||
readPreference: 'secondaryPreferred'
|
||||
}
|
||||
const mongoClient = new MongoClient(mongoUri, mongoOptions);
|
||||
|
||||
/*============== CODE ==============*/
|
||||
async function run() {
|
||||
|
Loading…
Reference in New Issue
Block a user