🔬
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
  • deleteOne(<filter>)

Was this helpful?

  1. Documentation
  2. Collection

deleteOne()

Delete a item from a collection

Example

db.collection("users").deleteOne({
    banned: false,
    accountCreated: "13/02/2023"
}).then(() => {
    //Item deleted from db;
}).catch(error => {
    console.log("error:", error);
});

deleteOne(<filter>)

Parameter
Description

filter

The filter used to select the item to remove

Previousdelete()Nextlength

Last updated 2 years ago

Was this helpful?