Update document requires atomic operators w

app.patch('/update', async(req, res) => {
    await client.connect();
    db = await client.db("Lab3");
    let collection = await db.collection("students");
    let susername = req.body.username

    let result = await collection.findOneAndUpdate(
        {username : susername}, req.body, {new: true}
    )

    res.send(result).status(200);
});

Hi everyone, I’m currenly facing a problem when I want to update data to my mongoDB database. I try to not specified what to update from the user, but let the user choose what to update. So that my findOneandUpdate parameter will be username as filter, req.body as the content to update to the database. Can anyone help me to solve this problem? Thank you so much!

Same issue so same solution as your other thread