MongoDB integration with NodeRed

I love this project. Using it a few days, so far without any problems till I tried to integrate MongoDB. I'm using Docker but I am totally lost by the lack of proper documentation. All docs seem outdated and the package names confusing. From my Docker host IP I can access everything, NodeRED and MongoDB but the only errors I get in NodeRED are MongoNetworkError: failed to connect to server [XX:27017] on first connect [MongoError: Authentication failed.]" . A network error seems logical but I highly doubt that is the issue here.

I suspect that the packages are outdated. I also pulled the latest image from MongoDB which is MongoDB 4.2.6. But its totally unclear if this could ever work with NodeRED. As I find packages:

node-red-contrib-mongodb
node-red-contrib-mongodb2
node-red-contrib-mongodb3
node-red-contrib-mongodb-variable
node-red-contrib-mongo-client
node-red-node-mongodb
node-red-mongodb

All with their own (outdated) documentation. This starts to get quite annoying now, I almost wasted one day of figuring out simply how to get NodeRED to communicate with MongoDB. What am I doing wrong? What package or configuration do I need? I almost tried all above packages in different configurations. I simply want to read and write stuff from/to MongoDB from NodeRED.

How are you addressing mongodb from node-red? For example, I believe you can't use localhost from within a container. Personally I only use Docker when there is a good reason, it just makes life complicated otherwise.

Thanks for your reply. I tried different things like localhost, 127.0.0.1, the name of the Mongo container (using the internal DNS resolution in Docker), the Docker host IP 192.168.x.x.

Nothing worked, got annoyed after wasting almost a full day, switched to MySQL. Setup worked in less than 5 minutes.

I am surprised that you have a requirement that can be satisfied by either mysql or mongodb, they are very different tools.

I am aware. I was planning to design something I had in mind entirely around MongoDB while most functions are perfectly suitable for SQL as well. I will just start off now with MySQL and only for a few things think of an alternative. It's not rocket science but it was more a trial case to actually start working more with MongoDB.

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