上QQ阅读APP看书,第一时间看更新
Test connection
Now that we have set up our database and the database user, let's test the connection. On the mLab database page, you should see the section shown in the following screenshot:
This is our connection string, using which we can connect to the database from our application or from mongo shell or from a GUI tool like Robo 3T. If you have MongoDB installed locally, you can test the connection from the mongo shell using the command as shown. Open a new Terminal/Prompt and run:
$ mongo ds211309.mlab.com:11309/smart-exchange -u admin -p admin123
We should see that the connection succeeded as shown in the following screenshot:
This concludes our connection test.
Update the connection string above with your connection string; otherwise, you will be connecting to my database.