Perhaps this way? This way, you do not need to query all the time.
You query just ONCE (normaly this should be faster).
import wixData from'wix-data';
var myDatabase = "HereTheNameOfYourDB"
var REFERENCE = "name"
var VALUE = $w('#userDropDown').value
$w.onReady(()=>{
let QUERY = wixData.query("MyDatabase")
$w('#userDropDown').onChange(()=>{
QUERY.eq(REFERENCE, VALUE).find()
.then((results) => {
if(results.items.length > 0){
let firstItem = results.items[0]
let items = results.items
let userData = results.items[0].data
console.log(firstItem)
console.log(items)
console.log(userData)
display_data_function(userData)
}
else{ }
})
.catch((err) => {
let errorMsg = err;
});
})
})
You can also use LIMITATION…(if you do not need to load the whole DB).
let QUERY = wixData.query("MyDatabase").limit(100)