Node-red Startup Console: connecting: mongodb://127.0.0.1:27017/{{mydb}}

Hopefully someone can explain to me what's going on when I start node-red,
I get a long list output on the console:

connecting:  mongodb://127.0.0.1:27017/{{mydb}}
connecting:  mongodb://127.0.0.1:27017/{{mydb}}
connecting:  mongodb://127.0.0.1:27017/{{mydb}}
connecting:  mongodb://127.0.0.1:27017/{{mydb}}
connecting:  mongodb://127.0.0.1:27017/{{mydb}}
...  ~x100

Repeats this for about 100x, and I know I have less than 20 MongoDB Nodes setup..
I even refined it to have MongoDB find, update, remove etc in their separate subflow, and just used that subflow instead of making multiply Mongo Node points. I would pass the msg.collection to this subflow. In theory I thought It would eliminate most mongo "instances" on this list, but I am seeing that it is not going away. There are still 100 or so, and seemingly not decreasing on changes.

Anyone know what's going on? I feel like there is many instances running, each eating up memory?

Do the messages have a node id associated with them?

Like a process ID?

Here is a sample from htop :

  971 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.00 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
  972 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.36 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1082 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:01.44 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1083 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.15 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1084 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.49 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1085 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.23 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1086 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.23 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1087 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.23 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1088 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.22 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1089 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.01 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1090 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:01.63 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1091 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.09 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1092 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.16 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
 1094 mongodb    20   0 1135M 88220 35512 S  0.0  4.4  0:00.00 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf

The Node Red Console reads this when starting up:

connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020

I am currently consolidating the DB's to a single node, and using them in a subflow...
I am using node-red-node-mongodb 0.2.5 flow to manage my the DB, which may be dated.

I also discovered there are some conflicts to some of the nodes?

How many instances of the subflow do you have?

Each of the subflow will have it's own connection to the database, subflows are just templates that are cloned for each instance of it on the canvas, they do not all share a single instance.

OK, so I continued to find all the MongoDB nodes in the flows, and now I have Isolated about 5 different MongoDB Nodes into their own subflow, Update, Save, Remove, Aggregate, Count ... So basically all my queries go through these subflows, instead of redundant MongoDB nodes all over the place. So I isolated these to subflows, and deleted all the redundant MongoDB nodes, and I am now glad to say that this now only reports a single line of connecting: mongodb://127.0.0.1:27017/psiaf2020 ...

I can't explain why there were so many loaded.

I have 5 consolidated subflows now each with a different MongoDB operation. I use a function to set the msg.collection before passing to the MongoDB subflows, to target specific collections for those operations.

I can't seem to dynamically change the operation ie find count aggregate save ... But can pass in msg.collection and change that. So that leads to the 5 separate operations I'm using.

I was thinking that each of these (redundant?) MongoDB nodes used throughout the flows were creating each line / connection instance to the DB server. But when I cleaned them out via seek and destroy, They all whittled down to 1 line on the console report, despite having down to now 5 instances.

I can't seem to explain what happened there.

**CORRECTION: I was wrong, as I had the MongoDB nodes deleted at the time of checking, thinking I put them in there. **
So I have the 5 subflows with the MongoDB operators, and that long list is back when I restart Node-Red.

connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
connecting:  mongodb://127.0.0.1:27017/psiaf2020
... ...

Maybe this is normal? And I'm just not understanding MongoDB core functionality?

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