I am writing code for a small administrative database. One of the things I need from the database is the ability to list existing collections and list them in checkboxes. However, I am unable to do this. Attached is the code I am using. At this point, I just need an array containing the collections that are already registered. My flow is attached.
I am using node-red-contrib-mongodb4
{
"id": "f33ae0340cb92cfd",
"type": "mongodb4",
"z": "012812a26a41e597",
"clientNode": "079563e7e443328f",
"mode": "db",
"collection": "",
"operation": "getCollectionInfos",
"output": "toArray",
"maxTimeMS": "0",
"handleDocId": false,
"name": "",
"x": 1170,
"y": 360,
"wires": [
[
"f652a658efb090bf"
]
]
},
{
"id": "f652a658efb090bf",
"type": "debug",
"z": "012812a26a41e597",
"name": "debug 5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1380,
"y": 360,
"wires": []
},
{
"id": "7105457f780bf9e4",
"type": "inject",
"z": "012812a26a41e597",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 800,
"y": 360,
"wires": [
[
"db80ab283244da62"
]
]
},
{
"id": "db80ab283244da62",
"type": "function",
"z": "012812a26a41e597",
"name": "Def. ",
"func": "const query = {\n listCollections: 1.0,\n authorizedCollections: true,\n nameOnly: true\n};\n\nconst options = {}; \n\nmsg.payload = [query, options];\n\nreturn msg;\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 990,
"y": 360,
"wires": [
[
"f33ae0340cb92cfd"
]
]
},
{
"id": "079563e7e443328f",
"type": "mongodb4-client",
"name": "",
"protocol": "mongodb",
"hostname": "",
"port": "27017",
"dbName": "Componentes",
"appName": "",
"authSource": "",
"authMechanism": "DEFAULT",
"tls": false,
"tlsCAFile": "",
"tlsCertificateKeyFile": "",
"tlsInsecure": false,
"connectTimeoutMS": "30000",
"socketTimeoutMS": "0",
"minPoolSize": "0",
"maxPoolSize": "100",
"maxIdleTimeMS": "0",
"uri": "",
"advanced": "{}",
"uriTabActive": "tab-uri-simple"
}
]```