1function doSomething(...){
2 let result1 = [];
3 let result2 = [];
4 admin.firestore().collection('...').where('some condition').get()
5 .then((results: any)=>{
6 results.forEach((element: any)=>{
7 if(some other condition){
8 result1.push(element);
9 }
10 })
11 .catch((error: any)=>{//log the error});
12 admin.firestore().collection('...').where('yet another condition').orderBy(...).get()
13 .then((results: any)=>{
14 results.forEach((element: any)=>{
15 result2.push(func(element)) //func is some manipulation
16 })
17 .catch((error: any)=>{//log the error});
18 return makeCalculation(result1, result2);
19}
20