I am trying to return the results array, which I will use to populate my datatable. It there are no results, that is OK, zero rows will populate. I already do it using SQL code, but was thinking to use wixData instead.
My equivalent SQL code is this:
.
.
. const results = await sql ( mySQL ); return results . payload . data . rows ;
But in your sql-example you await the result. But you don’t do that in your wix-data code. You declare it async, but then you do not wait for the promise to resolve, you return myResults, which is not resolved yet.
So you either use async/ await or move the return upwards using .then (and remove async from function declaration). Have a look at some backend examples in API docs how and where to put the return.
I believe that you are making the mistake of not distinguishing between backend and frontend code. The wix-data examples are usually all frontend (if you see $w in an example, it is always frontend).