Answers for "insertpne vs create in mongodb"

0

insertpne vs create in mongodb

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)
        }
    }
Posted by: Guest on October-08-2021

Browse Popular Code Answers by Language