📜  insertpne vs create in mongodb - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:30.855000             🧑  作者: Mango

代码示例1
for (let i = 0; i < data.length; i++) {
        const dbData = await db.contact.findOne({ email: data[i].email });
        if (!dbData) {
            const inseredData = await db.contact.create(data[i]);
            console.log(inseredData)
        }
    }