Mongodb Atlas - Service account x509 login without password fails

Describe the problem/error/question

I can’t connect to my mongodb Atlas cluster using only x509. I have a service account for my cluster, set to strict certificate only authentication with atlas managed certificate. No username or password are created and thus not part of the connection string. Saving / testing the credentials shows that no database is found.

I’ve activated tls and added public certificate and private key, as that’s the only things you get from atlas when creating an x509 only service account.

What is the error message (if any)?

Database xyz not found.

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:latest
  • Database (default: SQLite): sqlite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Debian 12

For MongoDB Atlas X.509 authentication in n8n, you need to configure the connection properly without username/password fields. Based on the [mongodb.com]( Configure Atlas Clusters Authentication - Atlas - MongoDB Docs ) documentation, Atlas X.509 authentication requires the certificate to be properly configured with the database user.

Here’s what you need to check:

• **Database User Setup**: In Atlas, ensure your X.509 service account has a database user created with the certificate’s subject as the username (this is typically the CN from your certificate)

• **Connection String**: Use a connection string format like `mongodb+srv://cluster.mongodb.net/yourDatabase?authSource=$external&authMechanism=MONGODB-X509`

• **Certificate Configuration**: In n8n’s MongoDB credentials, enable TLS and provide both the public certificate and private key files you downloaded from Atlas

• **Authentication Source**: Make sure to set `authSource=$external` in your connection parameters, as X.509 authentication requires this specific auth source

The “Database xyz not found” error suggests the connection is being attempted but the authentication or database specification isn’t correct. Double-check that your certificate subject matches exactly with the database user you created in Atlas.