mongodbinsertretool

How to insertMany from MongoDB on Retool?


I am using MongoDB on Retool and I want to do insertMany. I don't understand why but for some reason, it is not available...

Does anyone know how I can do it? Potentially using another method as an alternative?

retool


Solution

  • Retool now supports insertMany!

    You can also use a JS query to trigger an insertOne query multiple times. In your JS query, use an async function to trigger a query for every item in a list:

    return (async () => {
      for (let d of data) {
        await myInsertOneQuery.trigger({ additionalScope: { id: d.id } });
      }
    })()