{ sailsit }

Sails Js Tutorials for Beginners and Forum

Have a Question?

If you have any question you can ask below or enter what you are looking for!

Sails – Mongo ReplicaSet Configuration

In SailsJs, to configure replica set for MongoDB
You can use MongoURI directly with all the details in your connnections.js file
Below is the MongoURI format



The above URI then can be used in Sails config/connections.js as below

mongoDB: {
    adapter: "sails-mongo",
    url: "mongodb://{replicaSet1}:{port},{replicaSet2}:{port},{replicaSetN}:{port}/{dbName}?replSet={replicaSetName}&readPreference=nearest&slaveOk=true"