# Mongodb dynamic access to collection - caused me problems

**URL:** <https://discourse.nodered.org/t/mongodb-dynamic-access-to-collection-caused-me-problems/22262>\
**Category:** General\
**Created:** [25 February 2020 23:35 UTC](https://discourse.nodered.org/t/mongodb-dynamic-access-to-collection-caused-me-problems/22262 "2020-02-25T23:35:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcpouliot](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcpouliot/32/4326_2.png) [@marcpouliot](https://discourse.nodered.org/u/marcpouliot)\
**Post date:** [25 February 2020 23:35 UTC](https://discourse.nodered.org/t/mongodb-dynamic-access-to-collection-caused-me-problems/22262/1 "2020-02-25T23:35:49Z")

</div>

if the field Collection is left empty, msg.collection allowed to contain the collection for that ... .. but...  
I used it and it crashed my system, node-red would constantly restart.giving mongdb errors So there was no way to get back to node-red.. stop-restart. reboot.. same thing  
I stopped node-red and removed the modules directories mongodb and mongodb-core because I could not do it from node-red.  
(should have stopped mongodb instead ???)  
if I try to remove mongo :  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e30a430636739ca3d6af2e810d6c89ab4b3bdc26.png)  
I get  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/7/b747adc3100a853ea185720fe67a4767ff0f25ef.png)  
and nothing in the log except :

* * *

2020-02-26T00:46:54.491Z Remove : node-red-contrib-mongodb2

So cannot remove mongodb cannot re-install it.

\*\*\*it waits for missing types to be registered. - (??) \*\*\*

25 Feb 19:36:34 - [info] Stopping flows  
25 Feb 19:36:34 - [info] Stopped flows  
25 Feb 19:28:13 - [info] Waiting for missing types to be registered:  
25 Feb 19:28:13 - [info] - mongodb2  
25 Feb 19:28:13 - [info] - mongodb2 in

☹  
I removed all the flows with the offending nodes with mongodb2,  
but it still get :  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9bb58da79b088a749e2a9ef4c82bcf01ef2fcb26.png) and nothing in the log.  
Cannot run node-red any more : flows are always stopped.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [26 February 2020 06:06 UTC](https://discourse.nodered.org/t/mongodb-dynamic-access-to-collection-caused-me-problems/22262/2 "2020-02-26T06:06:20Z")

</div>

Stop node-red and start it in safe mode:

`node-red --safe`

now you can remove or change the offending nodes and deploy.

---

<div class="post-metadata">

**Author:** ![marcpouliot](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcpouliot/32/4326_2.png) [@marcpouliot](https://discourse.nodered.org/u/marcpouliot)\
**Post date:** [26 February 2020 14:06 UTC](https://discourse.nodered.org/t/mongodb-dynamic-access-to-collection-caused-me-problems/22262/3 "2020-02-26T14:06:04Z")

</div>

WOW  
Thank so much bakman2, I did not know about this neat trick.  
I managed to get rolling again !!!  
for other options :  
[https://nodered.org/docs/getting-started/local#command-line-usage](https://nodered.org/docs/getting-started/local#command-line-usage)

---

<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:** [11 March 2020 14:06 UTC](https://discourse.nodered.org/t/mongodb-dynamic-access-to-collection-caused-me-problems/22262/4 "2020-03-11T14:06:09Z")

</div>

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