# Node-RED MongoDB Update Example

**URL:** <https://discourse.nodered.org/t/node-red-mongodb-update-example/15022>\
**Category:** General\
**Created:** [2 September 2019 08:33 UTC](https://discourse.nodered.org/t/node-red-mongodb-update-example/15022 "2019-09-02T08:33:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zgrdev](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zgrdev](https://discourse.nodered.org/u/zgrdev)\
**Post date:** [2 September 2019 08:33 UTC](https://discourse.nodered.org/t/node-red-mongodb-update-example/15022/1 "2019-09-02T08:33:04Z")

</div>

hello everyone. i need some help for node-red and mongodb update command. i didn't update my ledButton value. here is my workflow

```auto
[{"id":"707a8db8.190a04","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"18422fa2.b250e","type":"function","z":"707a8db8.190a04","name":"build operation parameters: filter, update","func":"var filter = msg.payload;\nif (\"string\" == typeof filter) {\n filter = JSON.parse(filter);\n}\n\nmsg.payload = [\n filter,\n {\n \"$set\": {\n \"ledButton\": true \n \n }\n }\n];\n\nreturn msg;\n","outputs":1,"noerr":0,"x":500,"y":280,"wires":[["d5dfb1c.951115"]]},{"id":"d5dfb1c.951115","type":"mongodb2 in","z":"707a8db8.190a04","service":"_ext_","configNode":"3f7edabd.002556","name":"","collection":"button","operation":"findOneAndUpdate","x":710,"y":180,"wires":[["d9faaf65.edeb6"]]},{"id":"664492e7.50550c","type":"inject","z":"707a8db8.190a04","name":"Inject filter","topic":"","payload":"{\"_id\": \"5d5fcdfe6eea790e6066f4c2\"}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":180,"y":180,"wires":[["18422fa2.b250e"]]},{"id":"d9faaf65.edeb6","type":"debug","z":"707a8db8.190a04","name":"","active":true,"console":"false","complete":"false","x":840,"y":241,"wires":[]},{"id":"3f7edabd.002556","type":"mongodb2","z":"","uri":"mongodb://zgrdev:a1b2c3@ds219040.mlab.com:19040/ads-test","name":"test","options":"","parallelism":"-1"}]

```

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 September 2019 08:37 UTC](https://discourse.nodered.org/t/node-red-mongodb-update-example/15022/2 "2019-09-02T08:37:21Z")

</div>

Unfortunately your flow isn't currently importable.Please read the following post [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) and then edit the above message.
