Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

MongoDB

Connect a MongoDB database to Fresco BI. Fresco BI only reads: it lists the collections of one database, infers columns from a sample of documents, and imports each collection into a Data Table.

Feature Supported
Import Yes
DirectQuery No
SSL/TLS Always on and verified
SSH tunnel No
Cloud Yes
On-premises (via Gateway) No
  • A MongoDB server or cluster reachable from the internet over TLS (for example MongoDB Atlas).
  • The name of the database to read.
  • An administrator who can create a database user.

Fresco BI needs the built-in read role on the database it reads. With mongosh, connected as an administrator:

use admin
db.createUser({
user: "fresco_reader",
pwd: "<strong-password>",
roles: [ { role: "read", db: "<database>" } ]
})

The user above lives in the admin database, which is the default authentication database in the form. If you create the user in another database, enter that database as the authentication database.

MongoDB Atlas. In Database Access, add a database user with password authentication and give it the read role on <database> only (a custom role or “Specific Privileges”), not a read-write role.

Fresco BI lists only the collections the user is allowed to read and skips system.* collections. Views are listed too.

Cloud. Allow inbound connections from Fresco BI’s outbound IP addresses (the setup guide beside the data source form lists them) on the MongoDB port (27017 by default).

  • MongoDB Atlas: in Network Access, add each IP to the IP Access List.
  • Self-managed server: bind mongod to a public interface, open the port in the host firewall for these IPs only, and turn on TLS on the server.

MongoDB has no SSH tunnel and no On-premises (Gateway) option in Fresco BI: the server must be reachable over the internet.

The web form for MongoDB is not available yet. The source takes these settings:

  1. Address type: srv (default) or standard.
  2. Hosts: for srv, exactly one host name with no port, and the name needs a parent domain (for example cluster0.abcde.mongodb.net). For standard, 1 to 7 hosts, each with an optional port (27017 when left out).
  3. Database: the database to read.
  4. Authentication database: where the user was created; default admin.
  5. Replica set: optional replica set name.
  6. User and Password: the user from Step 1. The password is stored encrypted and never shown again.
  7. Read preference: secondaryPreferred (default), primary or secondary.
  8. Sample size: how many documents are sampled to find the columns, 100 to 1,000 (default 1,000).
  9. Flatten depth: how many levels of nested objects become their own columns, 0 to 3 (default 1). A field address.city becomes the column address_city; deeper objects and arrays stay as JSON text.
  10. CA certificate (PEM): optional. Paste it when the server certificate is signed by a private CA.

For an srv address, Fresco BI looks up the SRV and TXT records itself. Every server in the SRV answer must share the parent domain of the SRV name, and the TXT record may only set authSource, replicaSet and loadBalanced.

  • Columns come from a sample of up to 1,000 documents; at most 500 columns per collection. A field missing from a document reads as blank.
  • Documents are read in _id order. On a replica set or sharded cluster running MongoDB 5.0 or later, the read uses a snapshot so the import is consistent.
  • TLS is always on and the server certificate is always verified; there is no option to turn it off.
  • The server rejected the user name or password. Check the user, the password and the authentication database (Atlas users live in admin).
  • The database user cannot read this object. Give the user the read role on the database.
  • The host name could not be resolved (DNS). Check the Host field. Check the SRV host name. For srv, the SRV record and every server it lists must resolve; servers outside the parent domain are refused.
  • No connection could be opened to this host and port. Check the host, the port, and that the firewall allows Fresco BI’s IP. Add Fresco BI’s outbound IP addresses (the setup guide beside the data source form lists them) to the IP Access List or firewall.
  • The server did not answer in time. Usually a firewall that drops packets, or a wrong host or port. Check the Atlas IP Access List and the port.
  • The SSL connection could not be set up with the chosen mode. Check the SSL mode and the CA certificate. The server must have TLS on, with a certificate issued for the host name you entered. For a private CA, paste it into the CA certificate field.
  • The host is in a blocked range (private, loopback or metadata). A database inside a private network needs an On-premises connection through a Gateway. MongoDB cannot use a Gateway; the server needs a public address.
  • The database or object was not found on the server. The collection was dropped or renamed since the Data Table was created.
  • A size or concurrent-connection limit was exceeded. A long read went past the server’s snapshot window; try again when the collection is less busy.