Hi Marina
Overall code consists of information, that might confuse you, that’s why here is the code you want exactly:
wixData.query('Users')
.find()
.then(res => {
function unique(array) {
return array.filter((value, index) => array.indexOf(value) === index);
}
const genders = res.items.map(users => users.gender);
const uniqueGenders = unique(genders);
const options = uniqueGenders.map(gender => {
return {
'value': gender, 'label': gender
};
});
$w('#genderDropDown').options = options;
});
So, this was my code before:
wixData.query("Users")
.between("age", 18)
.contains("hairColor", hairColor)
.find()
.then( (results) => {
let resultQuery = results.query;
})
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
});
}
Put Itai’s code after:
.then(results) => {
Itai’s code.