百度智能云

All Product Document

          Cloud Database MONGODB

          Connect to Sharded Cluster Instance Through MongoShell

          Mongo Shell is a database management tool that comes with the MongoDB database. You can create a BCC in the VPC where the shard set resides, install the Mongo Shell tool in the instance, and then connect to the shard set instance through Mongo Shell.

          Prerequisites

          • To ensure successful authentication, you need to install the Mongo Shell version corresponding to the MongoDB instance version. For installation steps, refer to the official documentation Install MongoDB. You need to select the version number in the upper left corner of the page according to your client version.
          • The IP address of the client has been added to the whitelist of the MongoDB instance. For details, refer to Set Whitelist.

          Operating Steps

          1. Log in to the MongoDB management console.
          2. In the upper left corner of the page, select the region where the instance resides.
          3. In the left navbar, click the Sharded Cluster Instance List.
          4. Find the target instance, and click Instance Name.
          5. In the Connection information of the Instance Basic Information page, click Copy All to get the connection information.

          1. Connect to the database through Connection String URI on the client where Mongo Shell resides.

          Command format:

          mongo "ConnectionStringURI"

          Example:

          mongo "mongodb://root:****@5H0athAAO.mongodb.bj.baidubce.com:27017,5H0athhgs.mongodb.bj.baidubce.com:27017/admin"

          Replace **** with the account password.

          Previous
          Connect to Replica Cluster Instance Through MongoShell
          Next
          Connect to MongoDB Instance Through Program Code