updateOne()

Update a single item in a collection

Example

db.collection("users").updateOne({banned: false, xp: "99999"}, {
    "$set": {
        xp: "0"
    }
}).then(() => {
    //Item have been updated;
}).catch(error => {
    console.log("error:", error);
});

updateOne(<filter>, <options>)

ParameterDescription

filter

The filter used to select the item to update

Last updated