Node-red mongodb2 update

#1

Hi friends,

The node-red stream is as follows.
How do I update with the code specified in "Set message payload function". I can insert insert with the same code, but I can't update the current record.

How do I update the function code?

Set message payload function
msg.payload ={"_id": msg["_id"]};
var msg = {
'collection' : 'cihazlar',
'operation': 'updateOne',
'payload': {
// '_id': '5c41cacec3bcb01b705c45b9',
'nodebolge': 'area',
'nodename': 'nameField',
'nodeabone': 'device3',
'endeks': 'index'
}
};
return msg;

Flow

Mongodb2
mqtt2

Switch
switch

Set message payload function
setmessagepayloadfunction

0 Likes

#2

Please don't open multiple questions for the same issue. It makes it harder for anyone else who has a similar problem and find this in the future

0 Likes