I'm receiving [object, Object] as query results, any help?

I have a site I’m using to manage my staff. I have a collection that records map coordinates following a clocking in or out, which I would then like to be able to display in a map.

I followed a tutorial to display multiple map coordinates in a hmtl window googlemap, sourced from a wix content collection, which all worked correctly. I am now attempting to filter the results by the current dynamic dataset item (current staff member), and results from this month. The eventual idea will be to filter the map by clock ins, or clock outs, and shifts or jobs.

My issue is that all of my results from the collection are coming in as [object, Object] instead of the results items.
I’ve console logged through the code to find where its going wrong, and its wrong right from the initial query. If i try to log the results.items.length, then i get the right number of results, but each result is just returned as [object, Object]

Ive included my page code below, thanks again for any help!


import wixData from 'wix-data';

$w.onReady(function () {
 

    sendLocations();
    $w("#html1").onMessage( (event) => {
 if(event.data === 'hello') {
            console.log("hello rec'd HERE")
            sendLocations();
        }
 else {
            $w('#SELECTEDJOB').text = "CURRENTLY SELECTED: " + event.data;
            console.log("no hello rec'd")
        }
    } );
});

function getLocations() {
 
     console.log("START getLocations CODE")
 let currentStaff = $w("#dynamicDataset").getCurrentItem();
 let staffId = currentStaff._id;
    console.log("STAFF ID:" + staffId)

 let startMonth = new Date();
    startMonth.setDate(1)
    startMonth.setMinutes(0)
    startMonth.setHours(0)
    startMonth.setSeconds(0)

 let today = new Date()
 let endMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
    endMonth.setMinutes(59);
    endMonth.setHours(23);
    endMonth.setSeconds(59);
    console. log("START MONTH:"+startMonth);
    console. log("END MONTH:" + endMonth);

 if ($w('#shiftOrJob').value === "SHIFTS") {
    console.log("IF SHIFT SELECTED")

 return wixData.query("CHECKIN") // the database to query is 'properties'
 //add filters for current staff and month
 
        .eq("staffMemeber", staffId)
        .ge("_createdDate", startMonth)
        .isEmpty("jobRef")
        .find()
         .then( (results) => {
 
             console.log("getLocations Results Items Values:" + results.items.values())
            console.log("getLocations Results:" + results)
            console.log("getLocations Results Items:" + results.items)
            console.log("getLocations item 1" + results.items[0])
 return results.items; // items is an array of locations from the collection
 
        })
        .catch((err) => {
 let errorMsg = err;
        });
    }
 else {
        console.log("ELSE SHIFT SELECTED")
 
 return wixData.query("CHECKIN") // the database to query is 'properties'
 //add filters for current staff and month
        .eq("staffMemeber", staffId)
        .ge("_createdDate", startMonth)
        .isNotEmpty("jobRef")
        .find()
        .then((results) => {
 return results.items; // items is an array of locations from the collection
 
        })
        .catch((err) => {
 let errorMsg = err;
        });
    }
 
}

function sendLocations() {
 
     getLocations().then((locations) => {
        console.log("locations:" + locations)
        console.log("NUMBER OF RESULTS" + locations.length)
 let markers = [];
 for (let i = 0; i < locations.length; i++) {
 let loc = locations[i];
            console.log("LOC LOCATIONS BEFORE IF:" + loc)
 if ($w('#inOrOut').value === "IN") {
                console.log("IF IN SELECTED")
                    markers.push({title: loc._createdDate, position: {lat: loc.latIn, lng: loc.longIn}});
            } else {
                markers.push({title: loc.checkOut, position: {lat: loc.latOut, lng: loc.longOut}});
                console.log("IF OUT SELECTED")
            }   
        }
        console.log("send locations markers:" + markers);
        $w('#html1').postMessage({markers});
    });
}