# Mongodb api and node red

**URL:** <https://discourse.nodered.org/t/mongodb-api-and-node-red/21857>\
**Category:** General\
**Created:** [17 February 2020 13:36 UTC](https://discourse.nodered.org/t/mongodb-api-and-node-red/21857 "2020-02-17T13:36:19Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [17 February 2020 18:23 UTC](https://discourse.nodered.org/t/mongodb-api-and-node-red/21857/4 "2020-02-17T18:23:56Z")

</div>

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](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](https://discourse.nodered.org/t/async-function-getting-error-typeerror-is-not-a-constructor/13259)

---

_[View the full topic](https://discourse.nodered.org/t/mongodb-api-and-node-red/21857)._
