Make MongoClient prefer secondaries
This commit is contained in:
		| @@ -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() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user