# Using environment variables in mongo db node

**URL:** <https://discourse.nodered.org/t/using-environment-variables-in-mongo-db-node/47659>\
**Category:** General\
**Created:** [25 June 2021 13:10 UTC](https://discourse.nodered.org/t/using-environment-variables-in-mongo-db-node/47659 "2021-06-25T13:10:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OmkarNodered](https://avatars.discourse-cdn.com/v4/letter/o/90ced4/32.png) [@OmkarNodered](https://discourse.nodered.org/u/OmkarNodered)\
**Post date:** [25 June 2021 13:10 UTC](https://discourse.nodered.org/t/using-environment-variables-in-mongo-db-node/47659/1 "2021-06-25T13:10:45Z")

</div>

Hello, I have created a flow which is having mongo db node-red-contrib-mongodb2 node .  
So, I have set environment variables in settings.js file as  
process.env.host="127.0.0.1";  
process.env.port = 27017;  
process.env.database="test;

I want to use these environment variables inside mongo db 2 node. How can do that?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 June 2021 13:14 UTC](https://discourse.nodered.org/t/using-environment-variables-in-mongo-db-node/47659/2 "2021-06-25T13:14:24Z")

</div>

Not sure why you have started a new thread.

> [@OmkarNodered](#):
>
> I want to use these environment variables inside mongo db 2 node. How can do that

Like I explained with a link to the docs and a screenshot in the other thread : [Node properties stored in external json file - #11 by Steve-Mcl](https://discourse.nodered.org/t/node-properties-stored-in-external-json-file/47638/11)

Ps, I would not use port and host as they may conflict with node-red. I'd use mongo\_host and mongo\_port

---

<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:** [24 August 2021 13:15 UTC](https://discourse.nodered.org/t/using-environment-variables-in-mongo-db-node/47659/3 "2021-08-24T13:15:04Z")

</div>

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