Return function - Firebase

Hi guys, why can’t my function return a result?
the result is always “undefined” but the console.log expects the right answer???

getAll() {
    let values;
    const db = firebase.firestore();
    db.collection('userProfile').get().then((snapshot) => {
      snapshot.docs.forEach(docs => {
        db.collection('userProfile').doc(docs.id).get().then((snapshotData) => {
          db.collection('userProfile').doc(docs.id).collection(`orderData`).get().then((oData) => {
            values = oData.docs.map(flattenDoc);
			 return values;
            console.log(values);
            function flattenDoc(doc) {
              return {id: doc.id, user: docs.id, name: snapshotData.data().firstName, ...doc.data()};
            }
          });
        });
      });
    });

Because there is no return statement in its body.

Hei yeah i know but with an return statement i only gut the solution of the current user, but i need an Object with the solutions of all users and their Documents.

Another solution is the FirebaseColectionGroup but i dont know how to use it i my case.

The Coe with the return function:

getitAll(): Promise<any> {
        return new Promise(resolve => {
            const db = firebase.firestore();
            db.collection('userProfile').get().then((snapshot) => {
                snapshot.docs.forEach(docs => {
                    db.collection('userProfile').doc(docs.id).get().then((snapshotData) => {
                        db.collection('userProfile').doc(docs.id).collection(`orderData`).get().then((oData) => {
                            function flattenDoc(doc) {
                                return { id: doc.id, user: docs.id, name: snapshotData.data().firstName, ...doc.data() };
                            }
​
                            resolve(oData.docs.map(flattenDoc));
                        });
                    });
                });
            });
        });
    }