I do not know what is your issue, but this one works properly…
import wixData from 'wix-data';
$w.onReady(function () {xxx();});
function xxx() {console.log("My function running...")
wixData.query("collection')'
.eq('number', '0000044')
.find()
.then((res)=>{console.log("RESULTS: ", res);
if(res.items.length>0) {
console.log("RESULT-length", res.items.length);
} else {console.log("No data found!");}
}).catch((err)=> {console.log("getPaymentHistory err", err);});
}