All Products
Document Center

Mongo shell connection

Last Updated: Jan 17, 2018

Note: ApsaraDB for MongoDB must be accessed using MongoDB Shell 3.0 or later versions; otherwise, authentication fails.


  1. Log on to the MongoDB console.

  2. Click an instance ID or View to go to the Basic Information page, as shown in the following figure. Then, obtain the domain name and port number for MongoDB connection.

    Obtain the domain name and port number for MongoDB connection

    Enclosed in red frames are the connection addresses and port numbers of two nodes, which are separated by colons.

  3. On ECS, use the mongo command to establish a connection. A command example is shown as follows.

    1. mongo --host -u root -p 123456 --authenticationDatabase admin