How to run updateOne command from mongodb on n8n?

hello my friends! :slight_smile:

please… how to run updateOne command from mongodb on n8n?

db.clients.updateOne(
   { _id: 25230911 },
   { $addToSet: { products: { $each: [ "camera", "electronics", "accessories" ] } } }
 )

I tried to do it using the n8n nodes but I couldn’t follow :confused:

Hi @rafaelpiton, I am afraid n8n’s MongoDB node does not have an option to directly access the methods provided by the MongoDB Node.js native driver.

You’d have to use the Update operation, though this wouldn’t come with support for $each unfortunately.

Are you using MognoDB’s cloud service? If so, you consider using their REST-like API instead through n8n’s HTTP Request node. Their documentation provides curl commands which you can import the HTTP Request node: An Introduction to the MongoDB Atlas Data API | MongoDB

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.