Problem getting arrays of objets with Firebase Database

I’m getting data from Firebase and I’m trying to put in into an array of objects. When I do so it seems like I have a problem with asynchronous reading. My array is underfined but my console.log show it with “Value below was evaluated just now”. Here is my code of the firebase date request:

let premiereEtoile = [];
let deuxiemeEtoile = [];
let troisiemeEtoile = [];

let resultats3 = [];

function joueurExiste(nom) {
return resultats3.some(function(el) {
    return el.nom === nom
});
};

db.collection('premiereEtoile').get().then((snapshot) => {
snapshot.forEach(doc => {
    premiereEtoile.push(doc.data().premiere);
    console.log(premiereEtoile);
});
function joueurExiste(nom) {
return resultats3.some(function(el) {
    return el.nom === nom
});
};
premiereEtoile.forEach(nom => {
    if (joueurExiste(nom)) {
        let i = resultats3.findIndex(x => x.nom == nom);
        resultats3[i].points += 3

    }
    else {
        resultats3.push({ nom: nom, points: 3})
    };
});

console.log(resultats3);

});

I’m new with asynchronous reading and I can’t seem to fin what I’m doing wrong. Thank you !