Can you provide a link to example that shows how to use a query with async/await
Async/await is a special language construct to make working with Promises easier. You can only
await a function that returns a Promise.
Query#foreach, which is used to fetch a set of records from the database based on some filter criteria, does not return a Promise. Therefore, it cannot be used with
await. Instead, it returns a
RecordStream object, which – as the name implies – implements Node.js’
Stream interface, i.e. it acts as an
There are no specific examples for using
async/await included in the documentation, but the general principals outlined in this tutorial apply.
Hope this helps!