# Data into dropdown

**URL:** <https://discourse.nodered.org/t/data-into-dropdown/63522>\
**Category:** General\
**Created:** [6 June 2022 15:48 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522 "2022-06-06T15:48:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 15:48 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/1 "2022-06-06T15:48:35Z")

</div>

Hey, is there any solution where I can have the data of fields from mongodb which is installed in raspberry pi and place them into a dropdown . I'm new so is there someone who can guide me to achieve this .Thank u

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 June 2022 15:56 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/2 "2022-06-06T15:56:57Z")

</div>

show us the output of the mongodb response in a form that can be copied, and i or others will provide an example, also tell us which values from response you want in the dropdown msg.options.

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 16:28 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/3 "2022-06-06T16:28:38Z")

</div>

The output for example:  
Name: Maria  
Age: 15  
Subject: Math, Physics  
Name: Alex  
Age: 16  
Subject: English  
I want to have dropdowns named : Name and Age and Subjects  
so the dropdown Name must have Maria and Alex  
dropdown Age must have 15 and 16 ...  
so dropdowns must have all the different data  
Hope you understand what I mean by that

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 17:32 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/5 "2022-06-06T17:32:04Z")

</div>

```auto
payload[0]

```

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7b656398f97fa6e19d19db920f523bfec46dac82.png)  
is that what you mean?

---

<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:** [6 June 2022 17:48 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/7 "2022-06-06T17:48:08Z")

</div>

> [@alexback](#):
>
> is that what you mean?

@E1cid is asking for sample data (as text, not a picture) - and asked you to use the "copy value" button and paste it as code between triple backticks `</>`

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7fe2d8d39370a991c1180bd88ef6c5d7c9ec840b.png)

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 17:57 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/10 "2022-06-06T17:57:29Z")

</div>

```auto
[{"_id":"629e3912e99af917c68972d0","name":"Maria","age":"15","subject":"Math"},{"_id":"629e3928e99af917c68972d1","name":"Alex","age":"16","subject":"English"}]

```

Here is it

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 17:58 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/11 "2022-06-06T17:58:06Z")

</div>

Thank u so much

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 June 2022 18:00 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/12 "2022-06-06T18:00:50Z")

</div>

```auto
[{"id":"334d337d.3c77fc","type":"inject","z":"692c6984.8f8378","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"_id\":\"629e3912e99af917c68972d0\",\"name\":\"Maria\",\"age\":\"15\",\"subject\":\"Math\"},{\"_id\":\"629e3928e99af917c68972d1\",\"name\":\"Alex\",\"age\":\"16\",\"subject\":\"English\"}]","payloadType":"json","x":190,"y":120,"wires":[["1966b1fb.4908a6","f2f7c76b.6e9bf8"]]},{"id":"1966b1fb.4908a6","type":"change","z":"692c6984.8f8378","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.name","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":220,"wires":[["b667ae2c.a4abc"]]},{"id":"f2f7c76b.6e9bf8","type":"change","z":"692c6984.8f8378","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.age","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":280,"wires":[["d46fdab7.f9935"]]},{"id":"b667ae2c.a4abc","type":"ui_dropdown","z":"692c6984.8f8378","name":"","label":"name","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":8,"width":0,"height":0,"passthru":true,"multiple":false,"options":[],"payload":"","topic":"topic","topicType":"msg","className":"","x":480,"y":220,"wires":[["7afbabb8.27e524"]]},{"id":"d46fdab7.f9935","type":"ui_dropdown","z":"692c6984.8f8378","name":"","label":"age","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":9,"width":0,"height":0,"passthru":true,"multiple":false,"options":[],"payload":"","topic":"topic","topicType":"msg","className":"","x":500,"y":280,"wires":[["7afbabb8.27e524"]]},{"id":"7afbabb8.27e524","type":"debug","z":"692c6984.8f8378","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":100,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

An example with your data in the inject node  
copy this and press ctrl i In the flow editor, paste and press import. Then press the inject node and then look at your dashboard for the dropdowns.

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 18:04 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/13 "2022-06-06T18:04:55Z")

</div>

Thank u . it works fine but is there any other solution without copying that to the inject node . I mean directly without injecting it?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 June 2022 18:05 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/14 "2022-06-06T18:05:55Z")

</div>

The inject node just simulates the result of your mongodb node attach the change nodes to you mongodb node.

For future reference it is best to supply a simple flow with the data in an inject node, then people who wish to help only have to edit your flow. the more you help with data and how you wish the result formatted, the more people will jump in and help, also if you get a solution it is best to mark it for others in the future, with similar issues.

Use a ui-control node to trigger your mongodb node then when some one lands on the dashboard the dropdowns will be auto updated.

ui-control example, i had to simulate the mongodb as i do not have it installled. Replace template node with the nodes required to query db.

```auto
[{"id":"e7e59324.a665f","type":"ui_ui_control","z":"692c6984.8f8378","name":"","events":"connect","x":110,"y":80,"wires":[["6fe75907.ad2d38"]]},{"id":"6fe75907.ad2d38","type":"template","z":"692c6984.8f8378","name":"simulate mongiodb result","field":"payload","fieldType":"msg","format":"handlebars","syntax":"plain","template":"[{\"_id\":\"629e3912e99af917c68972d0\",\"name\":\"Maria\",\"age\":\"15\",\"subject\":\"Math\"},{\"_id\":\"629e3928e99af917c68972d1\",\"name\":\"Alex\",\"age\":\"16\",\"subject\":\"English\"}]","output":"json","x":240,"y":180,"wires":[["1966b1fb.4908a6","f2f7c76b.6e9bf8"]]},{"id":"1966b1fb.4908a6","type":"change","z":"692c6984.8f8378","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.name","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":220,"wires":[["b667ae2c.a4abc"]]},{"id":"f2f7c76b.6e9bf8","type":"change","z":"692c6984.8f8378","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.age","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":280,"wires":[["d46fdab7.f9935"]]},{"id":"b667ae2c.a4abc","type":"ui_dropdown","z":"692c6984.8f8378","name":"","label":"name","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":8,"width":0,"height":0,"passthru":true,"multiple":false,"options":[],"payload":"","topic":"topic","topicType":"msg","className":"","x":480,"y":220,"wires":[["7afbabb8.27e524"]]},{"id":"d46fdab7.f9935","type":"ui_dropdown","z":"692c6984.8f8378","name":"","label":"age","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":9,"width":0,"height":0,"passthru":true,"multiple":false,"options":[],"payload":"","topic":"topic","topicType":"msg","className":"","x":500,"y":280,"wires":[["7afbabb8.27e524"]]},{"id":"7afbabb8.27e524","type":"debug","z":"692c6984.8f8378","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":100,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 18:11 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/16 "2022-06-06T18:11:16Z")

</div>

it works fine but when I add another document it doesn't added automatically to the dropdown

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 18:12 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/17 "2022-06-06T18:12:30Z")

</div>

Use a ui-control node to trigger your mongodb node then when some one lands on the dashboard the dropdowns will be auto updated.  
Can you please explain me how to do it 😅  
I need to do so

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 18:20 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/18 "2022-06-06T18:20:13Z")

</div>

I copy it but I got empty dropdowns 😕

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 18:30 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/21 "2022-06-06T18:30:59Z")

</div>

sorry but I just have copied ur example and replace the template with mongodb node

```auto
[
    {
        "id": "5ca821d075388ef8",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "ae816914c2834490",
        "type": "ui_ui_control",
        "z": "5ca821d075388ef8",
        "name": "",
        "events": "connect",
        "x": 220,
        "y": 800,
        "wires": [
            [
                "6b11ea195295fa40"
            ]
        ]
    },
    {
        "id": "3038b37c4e9a9468",
        "type": "change",
        "z": "5ca821d075388ef8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "options",
                "pt": "msg",
                "to": "$$.payload.name",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 390,
        "y": 940,
        "wires": [
            [
                "3a3140796502d60e"
            ]
        ]
    },
    {
        "id": "9d33eff08f0812a4",
        "type": "change",
        "z": "5ca821d075388ef8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "options",
                "pt": "msg",
                "to": "$$.payload.age",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 390,
        "y": 1000,
        "wires": [
            [
                "35bba1967152dd05"
            ]
        ]
    },
    {
        "id": "3a3140796502d60e",
        "type": "ui_dropdown",
        "z": "5ca821d075388ef8",
        "name": "",
        "label": "name",
        "tooltip": "",
        "place": "Select option",
        "group": "2d4fe667.28f8ba",
        "order": 8,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 590,
        "y": 940,
        "wires": [
            [
                "5da7e79dba81c06f"
            ]
        ]
    },
    {
        "id": "35bba1967152dd05",
        "type": "ui_dropdown",
        "z": "5ca821d075388ef8",
        "name": "",
        "label": "age",
        "tooltip": "",
        "place": "Select option",
        "group": "2d4fe667.28f8ba",
        "order": 9,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 610,
        "y": 1000,
        "wires": [
            [
                "5da7e79dba81c06f"
            ]
        ]
    },
    {
        "id": "5da7e79dba81c06f",
        "type": "debug",
        "z": "5ca821d075388ef8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 860,
        "wires": []
    },
    {
        "id": "6b11ea195295fa40",
        "type": "mongodb-node",
        "z": "5ca821d075388ef8",
        "mongodb": "a01ab8825d064c0b",
        "name": "",
        "collection": "students",
        "operation": "find",
        "upsert": false,
        "multi": false,
        "x": 230,
        "y": 880,
        "wires": [
            [
                "3038b37c4e9a9468",
                "9d33eff08f0812a4"
            ]
        ]
    },
    {
        "id": "2d4fe667.28f8ba",
        "type": "ui_group",
        "name": "demo",
        "tab": "1caa8458.b17814",
        "order": 1,
        "disp": true,
        "width": "12",
        "collapse": false
    },
    {
        "id": "a01ab8825d064c0b",
        "type": "mongodb-config",
        "hostname": "127.0.0.1",
        "port": "27017",
        "db": "myDB",
        "name": ""
    },
    {
        "id": "1caa8458.b17814",
        "type": "ui_tab",
        "name": "Demo",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

another issue it that when I have two similiar data (eg : I have two students with the age 15) it dipslayed twice (double 15) in dropdown so how even when I have similiar data it dispalyes once? how can I prevent redundancy.  
thank u for ur help and ur time I really appreciate it

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 June 2022 19:13 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/22 "2022-06-06T19:13:13Z")

</div>

```auto
$distinct($$.payload.age)

```

Jsonata has a distinct function.

You need to answer my question about mongodb if you require help with it. supply your original flow so I can see how you use mongodb.

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 19:13 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/23 "2022-06-06T19:13:26Z")

</div>

okay can you please help me fix the redundancy and update problem ?  
thank u

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 19:18 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/25 "2022-06-06T19:18:13Z")

</div>

I didn't understand what u mean.. I already paste my flow above .. it works fine without ui-control but when I add it it displays nothing ..

```auto
[
    {
        "id": "5ca821d075388ef8",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "ae816914c2834490",
        "type": "ui_ui_control",
        "z": "5ca821d075388ef8",
        "name": "",
        "events": "connect",
        "x": 220,
        "y": 800,
        "wires": [
            [
                "6b11ea195295fa40"
            ]
        ]
    },
    {
        "id": "3038b37c4e9a9468",
        "type": "change",
        "z": "5ca821d075388ef8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "options",
                "pt": "msg",
                "to": "$$.payload.name",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 390,
        "y": 940,
        "wires": [
            [
                "3a3140796502d60e"
            ]
        ]
    },
    {
        "id": "9d33eff08f0812a4",
        "type": "change",
        "z": "5ca821d075388ef8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "options",
                "pt": "msg",
                "to": "$$.payload.age",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 390,
        "y": 1000,
        "wires": [
            [
                "35bba1967152dd05"
            ]
        ]
    },
    {
        "id": "3a3140796502d60e",
        "type": "ui_dropdown",
        "z": "5ca821d075388ef8",
        "name": "",
        "label": "name",
        "tooltip": "",
        "place": "Select option",
        "group": "2d4fe667.28f8ba",
        "order": 8,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 590,
        "y": 940,
        "wires": [
            [
                "5da7e79dba81c06f"
            ]
        ]
    },
    {
        "id": "35bba1967152dd05",
        "type": "ui_dropdown",
        "z": "5ca821d075388ef8",
        "name": "",
        "label": "age",
        "tooltip": "",
        "place": "Select option",
        "group": "2d4fe667.28f8ba",
        "order": 9,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 610,
        "y": 1000,
        "wires": [
            [
                "5da7e79dba81c06f"
            ]
        ]
    },
    {
        "id": "5da7e79dba81c06f",
        "type": "debug",
        "z": "5ca821d075388ef8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 860,
        "wires": []
    },
    {
        "id": "6b11ea195295fa40",
        "type": "mongodb-node",
        "z": "5ca821d075388ef8",
        "mongodb": "a01ab8825d064c0b",
        "name": "",
        "collection": "students",
        "operation": "find",
        "upsert": false,
        "multi": false,
        "x": 230,
        "y": 880,
        "wires": [
            [
                "3038b37c4e9a9468",
                "9d33eff08f0812a4"
            ]
        ]
    },
    {
        "id": "2d4fe667.28f8ba",
        "type": "ui_group",
        "name": "demo",
        "tab": "1caa8458.b17814",
        "order": 1,
        "disp": true,
        "width": "12",
        "collapse": false
    },
    {
        "id": "a01ab8825d064c0b",
        "type": "mongodb-config",
        "hostname": "127.0.0.1",
        "port": "27017",
        "db": "myDB",
        "name": ""
    },
    {
        "id": "1caa8458.b17814",
        "type": "ui_tab",
        "name": "Demo",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 June 2022 19:22 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/26 "2022-06-06T19:22:43Z")

</div>

My example did not have a function.

I asked for yoyur original flow where you got the data example i first asked for. The flows you posted were my examples of using drop down, but with a db node not a template. I want to see how the db node worked and how you retrevied data that now you seem unable to get.

---

<div class="post-metadata">

**Author:** ![alexback](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@alexback](https://discourse.nodered.org/u/alexback)\
**Post date:** [6 June 2022 19:24 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/28 "2022-06-06T19:24:55Z")

</div>

```auto
[
    {
        "id": "25f80f7eb748b47a",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "f5d5bbc2b33b78b2",
        "type": "inject",
        "z": "25f80f7eb748b47a",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 210,
        "y": 180,
        "wires": [
            [
                "b9a2c0016f7f7d65"
            ]
        ]
    },
    {
        "id": "b9a2c0016f7f7d65",
        "type": "mongodb-node",
        "z": "25f80f7eb748b47a",
        "mongodb": "a01ab8825d064c0b",
        "name": "",
        "collection": "students",
        "operation": "find",
        "upsert": false,
        "multi": false,
        "x": 510,
        "y": 220,
        "wires": [
            [
                "79bf4a4e987c9a3f"
            ]
        ]
    },
    {
        "id": "79bf4a4e987c9a3f",
        "type": "debug",
        "z": "25f80f7eb748b47a",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 830,
        "y": 200,
        "wires": []
    },
    {
        "id": "a01ab8825d064c0b",
        "type": "mongodb-config",
        "hostname": "127.0.0.1",
        "port": "27017",
        "db": "myDB",
        "name": ""
    }
]

```

Is that what you mean?  
I only need to how to update automatically the dropdown

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 June 2022 19:32 UTC](https://discourse.nodered.org/t/data-into-dropdown/63522/29 "2022-06-06T19:32:13Z")

</div>

In your original flow you inject payload true. That is only difference  
try

```auto
[{"id":"27a0a170.6ece86","type":"ui_ui_control","z":"2356cb00.dc20c6","name":"","events":"connect","x":220,"y":800,"wires":[["c102bb19.6a33a"]]},{"id":"c102bb19.6a33a","type":"change","z":"2356cb00.dc20c6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":840,"wires":[["96ba1b84.982f4"]]},{"id":"96ba1b84.982f4","type":"mongodb-node","z":"2356cb00.dc20c6","mongodb":"a01ab8825d064c0b","name":"","collection":"students","operation":"find","upsert":false,"multi":false,"x":230,"y":880,"wires":[["82f81638.889cb8","a3326a8e.d51b78"]]},{"id":"82f81638.889cb8","type":"change","z":"2356cb00.dc20c6","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.name","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":940,"wires":[["d06031f.049da5"]]},{"id":"a3326a8e.d51b78","type":"change","z":"2356cb00.dc20c6","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.age","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1000,"wires":[["2f86c627.8a1842"]]},{"id":"d06031f.049da5","type":"ui_dropdown","z":"2356cb00.dc20c6","name":"","label":"name","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":8,"width":0,"height":0,"passthru":true,"multiple":false,"options":[],"payload":"","topic":"topic","topicType":"msg","className":"","x":590,"y":940,"wires":[["f30747cf.fa7c68"]]},{"id":"2f86c627.8a1842","type":"ui_dropdown","z":"2356cb00.dc20c6","name":"","label":"age","tooltip":"","place":"Select option","group":"2d4fe667.28f8ba","order":9,"width":0,"height":0,"passthru":true,"multiple":false,"options":[],"payload":"","topic":"topic","topicType":"msg","className":"","x":610,"y":1000,"wires":[["f30747cf.fa7c68"]]},{"id":"f30747cf.fa7c68","type":"debug","z":"2356cb00.dc20c6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":860,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

[Next page](https://discourse.nodered.org/t/data-into-dropdown/63522.md?page=2)
