I have a multi-region database (MongoDB) infrastructure with replication. I want to record data to master DB and read data from other DB (replication) in the same region with the application server. How to implement it? Thanks
In config/connection.js
:
mongodb: {
adapter : 'sails-mongo',
ssl: {
rejectUnauthorized: false
},
url: 'mongodb://0.0.0.1,0.0.0.2:27017/db-name?replicaSet=rs0',
readPreference: 'secondary'
},