Full width home advertisement

IT Sharing

Travel the world

Climb the mountains

Post Page Advertisement [Top]

 



Hi guys,
As you know that mlab.com now is a part of MongoDB atlas, also the connection from Sails Js apps to MongoDB has to change to adapt new connection info (cluster) using sails-mongo (versions:^1.2.0")

I'll go through the steps on how to create a cluster on Mongodb.com I think it very easy.
Okay let's go to config
Step 1: After the Cluster created you need to go to the cluster detail, look below you can see we have 1 primary cluster and two secondary clusters.

Let go through each cluster and copy each shared cluster URL to note, we'll use it for config next step;

Step 2: Config data store for Sails Js, let config like below
url:'mongodb://user:pass@url of shared cluster primary,URL of shared cluster secondary/database name',
replicaSet: see in the detailed cluster page to set your correct replica Set
authSource:"admin"

adapter: 'sails-mongo',
url:'mongodb://usersample:passsample@clusterprimary-shard-00-00.abcd.mongodb.net:27017/sampledb',
ssl: true ,
replicaSet:'atlas-sample-shard-0',
authSource:'admin',


That's all config if you have any question please contact me via FB: https://www.facebook.com/leo.trinh.6890/





Không có nhận xét nào:

Đăng nhận xét

Bottom Ad [Post Page]