Please how do I get this code to work?

async function retrieveAllItemsx() {  
let allItemsx= [];
let hasNextx = true;
let countx = 0
    let resultx = await wixData.query("WEEKERS")
    countx += resultx.items.length;
    hasNextx = resultx.hasNext();
return allItemsx[0]
(async () => {

let allItemex9 = await retrieveAllItemsx()
console.log("ALL ITEMS ARE",allItemex9)
let updating={//update 
// "total":(allItemex9.length).toString(),

"APTOTAL", updating)
        .then((result) => {
          let item = result; //see item below

 .catch((err) => {
 let errorMsg = err;

I am trying to get all the items from a database and count them and save, but it is not working. Also if a dataset is connected to a database with 10k items, does the .getTotalCount() return the 10k number or are there limits?