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;
|
const PORT = process.env.PORT || 3002;
|
||||||
|
|
||||||
// Create Mongo client
|
// Create Mongo client
|
||||||
const mongoClient = new MongoClient(mongoUri);
|
const mongoOptions = {
|
||||||
|
readPreference: 'secondaryPreferred'
|
||||||
|
}
|
||||||
|
const mongoClient = new MongoClient(mongoUri, mongoOptions);
|
||||||
|
|
||||||
/*============== CODE ==============*/
|
/*============== CODE ==============*/
|
||||||
async function run() {
|
async function run() {
|
||||||
|
Loading…
Reference in New Issue
Block a user