Connect MongoDB

A MongoDB source reads a MongoDB server or a MongoDB Atlas cluster into the Lake. The form has the steps General, Connection and Review: paste a connection URI or fill in the server fields, choose how to authenticate, and set the advanced driver options.

Add a MongoDB source

  1. Open Lake and click Add datasource in the header, or open the New menu in the toolbar above the tree.
  2. Choose MongoDB in the picker. Supported connectors shows how the picker is grouped. The form opens on the General step.
  3. On General, enter Name and Code and choose a Folder if you want one, then click Next. Add a data source explains these shared fields and their rules.
  4. On Connection, fill in the Server and Authentication cards, the Advanced section and the Test connection card, in that order. Test connection is optional.
  5. On Review, check the summary and click Add.

Fill in the Server card

Choose authentication

Set the advanced options

The Advanced section starts collapsed and opens by itself when one of its values is set.

Test the connection

The Test connection card sits at the foot of the Connection step and starts as Not tested.

Review and save

The Summary card lists the source: Name, Connection type, Host, Database and Authentication, then Auth source or Replica set when they are set, TLS, and Server version when the compatibility driver is chosen.

Click Add to create the source. Once it is saved, import its tables.

Edit or duplicate

Questions, answered

Which connection type should I pick?

Standard (mongodb://) connects to a server or replica set reached by host and port. Atlas, DNS seed list (mongodb+srv://) is for MongoDB Atlas and other SRV clusters, where DNS supplies the hosts and port.

What does a pasted connection string fill in?

It fills the connection type, host, port, database, user, password and the options it can read. Click Paste connection string, paste a mongodb:// or mongodb+srv:// URI and click Fill, or press Enter. If no host is found, the row reads "No host found. Paste a mongodb:// or mongodb+srv:// URI.".

Why is there no Port field on my Atlas connection?

SRV records supply the port, so the form asks for the Cluster host only and leaves the port out. Enter the host name alone; a port or a comma in the field reads "Enter only the cluster host name - SRV records supply the port".

Do I have to enter a database?

No. Database is optional and every database the user can read is listed either way. With no value, the summary shows All databases.

When should I choose No authentication?

Only for servers that accept connections without a user. The choice removes the Username and Password fields and clears the password. Switch back to Username & password for a database user (SCRAM), which is the usual choice.

My server runs MongoDB 4.0. What do I set?

Open Advanced and set Server version to 4.0 or older. It uses the compatibility driver for servers the default driver no longer supports. The choice is shown on standard connections only.

Can I turn TLS off for an Atlas connection?

No. An SRV connection always uses TLS and shows the badge TLS is always on for SRV instead of the TLS/SSL switch. The switch is shown on standard connections only.

Why did my CA certificate disappear?

Turning TLS/SSL off on a standard connection clears the certificate, because it only applies to an encrypted connection. Turn TLS back on and paste or upload the certificate again.

When do I need a CA certificate?

Only when the server certificate is not issued by a public authority. The field appears while TLS is on; paste the PEM text or click Upload .pem. If the file cannot be read, the field reads "Could not read the certificate file:" and the reason.

What is Auth source for?

It is the database that holds the user. Leave it empty to use the Database you set, or admin when no database is set.