checking if a collection in indexeddb is empty

I’m trying to check if x is empty or has 30 entries, I wrote this however everytime I run it it doesn’t use the data saved in indexeddb [it adds entries [duplicate, already existing] how can I fix this?

let x = repo.getjuzs()
let y = Object.keys(x).length;
alert(typeof(y))
if (y < 30) {
    const juzs = await getJuzs();
    juzs.map(j => repo.addjuz(j))
    document.querySelector('#juz-DropDown').innerHTML = `
            ${juzs.map(j => `<option value="${j.id}">${j.juz_number}</option>`).join('n')}
        `;
    
}
const juzs = repo.getjuzs()
document.querySelector('#juz-DropDown').innerHTML = `
            ${juzs.map(j => `<option value="${j.id}">${j.juz_number}</option>`).join('n')}
        `;