Hello,
It is about the following function that I would like to use with the MongoDB Node:
function getNextSequenceValue(sequenceName){
var sequenceDocument = db.devices.findAndModify({
query:{_id: sequenceName },
update: {$inc:{sequence_value:1}},
new:true
});
return sequenceDocument.sequence_value;
}
db.devices.insert({
"_id":getNextSequenceValue("productid"),
"product_name":"Test Device",
"category":"pc"
})
The function works perfectly with mongosh.
Unfortunately, I can’t manage to implement the function with n8n.
Could someone help me here? I am still a beginner