Skip to main content

Connecting to MongoDB Atlas

The following guide shows how to configure Veezoo to connect to MongoDB Atlas.

Veezoo connects to MongoDB through the Atlas SQL Interface, which exposes your collections as SQL tables via an Atlas Data Federation instance. This requires a MongoDB Atlas cluster — self-hosted MongoDB is not supported.

Prerequisite: enable the Atlas SQL Interface

  1. In the Atlas UI, go to Data Federation and create a Federated Database Instance (or use the Enable Atlas SQL quick-start, which creates one for you).
  2. Add the clusters, databases and collections you want to query to the federated database.
  3. On the federated instance, click Connect, choose Atlas SQL, and select JDBC. Copy the hostname from the connection string — it looks like atlas-sql-1234abcd5678efgh-a1bcd.a.query.mongodb.net.

Creating a database user

Create a database user for Veezoo under Database Access in the Atlas UI. Read-only access is sufficient: the Atlas SQL Interface is read-only by design.

Make sure Veezoo's IP address is allowed under Network Access.

Configuring the connection in Veezoo

In the Veezoo database connection form, select MongoDB Atlas and fill in:

  • Atlas SQL Host: the hostname copied from the JDBC connection string.
  • Port: 27017 (default).
  • Username / Password: the database user created above.
  • Federated Database: the name of the virtual database in your federated instance.

Schema management, polymorphism and arrays

The Atlas SQL Interface infers a SQL schema for each collection from a sample of the documents:

  • Polymorphic fields (fields whose type varies across documents, e.g. sometimes a string and sometimes a date) are projected as their dominant type. Querying such a field can fail at runtime on the rows holding another type. If possible, clean up the data, or pin the field's type with the sqlSetSchema command in mongosh.
  • Nested documents and arrays are exposed as complex columns that Veezoo does not import. To query nested data, flatten it into views in your federated database, or pin a flattened schema via sqlSetSchema.
  • If the inferred schema becomes stale after the data changes shape, regenerate it with sqlGenerateSchema.

Supported and unsupported features

Most Veezoo features work as usual. Known limitations of the Atlas SQL dialect:

  • Window functions are not supported. Questions that need them (e.g. grouped Top-N) are answered through Veezoo's built-in post-processing instead, which can be slower on large results.
  • Median is computed through post-processing as well, since Atlas SQL has no median aggregate.