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

**URL:** <https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722>\
**Category:** General\
**Created:** [4 December 2021 21:24 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722 "2021-12-04T21:24:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrSidX](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrsidx/32/18935_2.png) [@mrSidX](https://discourse.nodered.org/u/mrSidX)\
**Post date:** [4 December 2021 21:24 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/1 "2021-12-04T21:24:08Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 December 2021 22:03 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/2 "2021-12-04T22:03:38Z")

</div>

Do the messages have a node id associated with them?

---

<div class="post-metadata">

**Author:** ![mrSidX](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrsidx/32/18935_2.png) [@mrSidX](https://discourse.nodered.org/u/mrSidX)\
**Post date:** [4 December 2021 22:04 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/3 "2021-12-04T22:04:17Z")

</div>

Like a process ID?

---

<div class="post-metadata">

**Author:** ![mrSidX](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrsidx/32/18935_2.png) [@mrSidX](https://discourse.nodered.org/u/mrSidX)\
**Post date:** [4 December 2021 22:05 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/4 "2021-12-04T22:05:30Z")

</div>

Here is a sample from `htop` :

```auto
  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

```

---

<div class="post-metadata">

**Author:** ![mrSidX](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrsidx/32/18935_2.png) [@mrSidX](https://discourse.nodered.org/u/mrSidX)\
**Post date:** [4 December 2021 22:15 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/5 "2021-12-04T22:15:08Z")

</div>

The Node Red Console reads this when starting up:

```auto
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?

 ![Screenshot 2021-12-04 141320](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/3/030748236255843b5d16cde94703f65b23483e75.png)

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [4 December 2021 22:31 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/6 "2021-12-04T22:31:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mrSidX](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrsidx/32/18935_2.png) [@mrSidX](https://discourse.nodered.org/u/mrSidX)\
**Post date:** [4 December 2021 22:32 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/7 "2021-12-04T22:32:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mrSidX](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrsidx/32/18935_2.png) [@mrSidX](https://discourse.nodered.org/u/mrSidX)\
**Post date:** [4 December 2021 22:40 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/8 "2021-12-04T22:40:58Z")

</div>

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.**

```auto
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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 February 2022 22:40 UTC](https://discourse.nodered.org/t/node-red-startup-console-connecting-mongodb-127-0-0-1-27017-mydb/54722/9 "2022-02-02T22:40:59Z")

</div>

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