P粉2686548732023-08-18 10:54:35
Just loop through the output
for (const [doc, num] of output) { const { id, name } = doc.employee; console.log({ id, name, num }); }
Or if you want to get data from an array of employees:
for (const employee of employee) { const entry = output.find(([doc]) => doc.employee.id === employee.id); if (entry) { const [doc, num] = entry; const { id, name } = employee; console.log({ id, name, num }); } }