MongoDB Node / Function


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}},
   return sequenceDocument.sequence_value;
   "product_name":"Test Device",

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 :slight_smile:

Hey @LycaKnight thanks for stepping by :slight_smile:

So I made a simple WF for you, please have a look if this work for you and don’t hesitate to ask if something is not clear for you :slight_smile:


1 Like