[ { "id": "b192e844.af15f8", "type": "mongodb3 in", "z": "b025da54.ae00b8", "service": "_ext_", "configNode": "7696cae5.bbfb0c", "name": "", "collection": "", "operation": "", "x": 650, "y": 380, "wires": [ [ "daa5cd32.69cbe8" ] ] }, { "id": "eb56d173.677008", "type": "inject", "z": "b025da54.ae00b8", "name": "Start Watch", "topic": "", "payload": "", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 110, "y": 380, "wires": [ [ "fab6e9fe.9c5da" ] ] }, { "id": "daa5cd32.69cbe8", "type": "debug", "z": "b025da54.ae00b8", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "x": 910, "y": 380, "wires": [] }, { "id": "fab6e9fe.9c5da", "type": "function", "z": "b025da54.ae00b8", "name": "Create Watch Command", "func": "msg.collection=\"devices\";\nmsg.operation=\"watch\";\npipeline = [\n {\n $project: { documentKey: false } }\n];\nvar options ={\nfullDocument:\"default\"\n};\nmsg.payload = [pipeline,options];\nreturn msg;", "outputs": 1, "noerr": 0, "x": 320, "y": 380, "wires": [ [ "b192e844.af15f8" ] ] }, { "id": "95a0fa00.f66788", "type": "mongodb3 in", "z": "b025da54.ae00b8", "service": "_ext_", "configNode": "7696cae5.bbfb0c", "name": "", "collection": "devices", "operation": "updateOne", "x": 710, "y": 440, "wires": [ [ "288eb87a.9393c8" ] ] }, { "id": "6de30c9b.8e1c34", "type": "function", "z": "b025da54.ae00b8", "name": "Create Document", "func": "deviceid = Date.now();\nmsg.payload = [\n {deviceid: deviceid},\n {$set: {example: 'hallo world' }},\n { upsert: true } \n ]\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 330, "y": 440, "wires": [ [ "95a0fa00.f66788" ] ] }, { "id": "288eb87a.9393c8", "type": "debug", "z": "b025da54.ae00b8", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1050, "y": 440, "wires": [] }, { "id": "1f88542f.f7d31c", "type": "inject", "z": "b025da54.ae00b8", "name": "Add Document", "topic": "", "payload": "", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 120, "y": 440, "wires": [ [ "6de30c9b.8e1c34" ] ] }, { "id": "7696cae5.bbfb0c", "type": "mongodb3", "z": "", "uri": "mongodb://192.168.2.91/smarthome", "name": "", "options": "", "parallelism": "-1" } ]