Mongodb api and node red

The outer function node code is synchronous, but capable of handling async code the same way you would do when writing ES6 compatible code yourself. Meaning you can use await, but it has to be inside an async function. Which in term can be run either with promises or callbacks. In order to output from the function node asynchronously, check the docs: https://nodered.org/docs/user-guide/writing-functions

See further this topic which has an example of async function calls in a function node: Async function - getting error: TypeError: is not a constructor

1 Like