Heim > Fragen und Antworten > Hauptteil
P粉2686548732023-08-18 10:54:35
只需遍历输出
for (const [doc, num] of output) { const { id, name } = doc.employee; console.log({ id, name, num }); }
或者,如果你想从一个员工数组中获取数据:
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 }); } }