🔬
Moonlight.DB
GitHubNPM
  • Introduction
  • Getting Started
  • Documentation
    • Database
      • createCollection()
      • deleteCollection()
      • collections
    • Collection
      • find()
      • findOne()
      • update()
      • updateOne()
      • insertOne()
      • insertMany()
      • delete()
      • deleteOne()
      • length
Powered by GitBook
On this page
  • Example
  • updateOne(<filter>, <options>)

Was this helpful?

  1. Documentation
  2. Collection

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>)

Parameter
Description

filter

The filter used to select the item to update

Previousupdate()NextinsertOne()

Last updated 2 years ago

Was this helpful?