MongoDB cannot connect on latest version of n8n (but works with older version)

Describe the issue/error/question

After upgrading my docker container to ‘latest’ version ( [0.206.1) of n8n the MongoDB connections stopped to work.
With an older version (0.173.1) works fine.

Error message

Not sure why it’s getting this error, when the connections string is not the provided.
I’m using something like: mongodb://user:[email protected]:27018/db-prd?authSource=admin&readPreference=secondary

I’ve opened a bug report MongoDB cannot connect on latest version of n8n (but works with older version) · Issue #4886 · n8n-io/n8n · GitHub

Hey @kimus,

I used the MongoDB node earlier today on 206.1 and it worked as expected on the latest MongoDB version from dockerhub I tried with both connection types in the credential.

Can you double check your connection string? It could be worth downgrading to the older version again to make sure it still works there as well.

@Jon , I’m sure the connection string is correct because I’ve downgraded to 0.173.1 and started to connect.

I even created a new instance of n8n from scratch and copied the same connection string from production server (the one I’ve downgraded) and didn’t connect in this new instance.

If you go to the GitHub issue other person has the same problem.

1 Like

@kimus,

I am now on the GitHub issue as well, Opening issues in 2 places can be a pain as it splits the attention. In this case though and for others watching the MongoDB node does work and will connect it is only when connecting to a secondary node it fails.

Using one node or Atlas works as expected.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.