How to Connect to MongoDb

Read first the Connection dialog page to understand the dialog fields( host, port, user, etc. ), SSH tunnel, etc. For a detailed list of MongoDb features read this page.

DbSchema can connect to MongoDb using the native MongoDb Java URI, by choosing 'Manually Edit JDBC URL'. Without this option you can entering the host, port, etc. and DbSchema will compose the JDBC URL.

Tip DbSchema features for MongoDb are explained here.

Connect Using MongoDb Native URI

You can connect using the Java URI as in MongoDb documentation. In the DbSchema Connection Dialog choose 'Manual Edit JDBC URL'. You may connect to multiple hosts and use custom parameters. The connection parameters are described in the MongoDB documentation.
Custom URL

Connect to MongoDb Atlas Cloud

In the Atlas console choose 'Connect Cluster' to find the Java URI connection string. There choose 'Connect using Application' and 'Java' latest version. Copy the URL in the DbSchema 'Manual Configure JDBC URL' filed. This is the same procedure as in the chapter above.
MongoDB Atlas Console

Connect Using the Dialog Fields

In the connection dialog you can enter the host, port, user and password ( by default not required ). From the Driver combo you can choose between connecting without authentication and with authentication.

The connection without authentication is the default one, unless you or an admin have set authentication on the server.


How to connect to MongoDB

How to setup authentication in MongoDb server

To setup authentication in MongoDb follow this steps:
  1. Create the user in database:
    use admin
    db.createUser(
      {
        user: "test",
        pwd: "test",
        roles: [ { role: "root", db: "admin" } ]
      }
    );
     
  2. Create a file mongo.config in the MongoDB installation folder. Edit to
    # Basic database configuration
    dbpath = C:\data\db
    bind_ip = 127.0.0.1
    port = 27017
    
    # Security
    auth = true
    
    # Administration & Monitoring
    nohttpinterface = true
            
  3. Start the mongodemon using mongod.exe -f mongo.config. You can text the connection using mongo.exe --port 20571 -u test -p test --host 127.0.0.1 admin .