This line here is SURELY WRONG!
wixData.query("datasetLoggedUser")
You put a DATASET-NAME/ID, but a COLLECTION-NAME is expected!
A DATASET is NOT-EQUAL —> DATABASE ! ! !
Run the following CODE…
import wixData from 'wix-data';
$w.onReady(()=>{
myFUNCTION();
})
function myFUNCTION(){
wixData.query("datasetLoggedUser")
.isEmpty("profilePhoto")
//.count() // <<<------- NOT sure if this can be used here!!!!
.find() // <<<------- Instead using this one.
.then( (results) => {console.log(results)
if(results.items.length > 0) {console.log("Existing items found")
$w("#text").text = "THERE IS A PHOTO"
}
else {$w("#text").text = "THERE IS NOT A PHOTO"}
})
}
Open your CONSOLE and take a look onto all the given RESULTS and informations!