🍒
Cherry3
Support
  • 🥳Welcome
    • 📕Change Log
  • 🎗️Model & Schema
    • 🪡Usage & Options
  • 🍒Operators
    • 🧵find()
    • 🧵allRows()
    • 🧵findOne()
    • 🧵findOneAndUpdate()
    • 🧵findOneAndDelete()
    • 🧵findById()
    • 🧵findByIdAndUpdate()
    • 🧵findByIdAndDelete()
    • 🧵insertOne()
    • 🧵insertMany()
    • 🧵updateOne()
    • 🧵updateMany()
    • 🧵deleteOne()
    • 🧵deleteMany()
    • 🧵create() & save()
    • 🧵schemaInfo()
    • 🧵dropCollection()
    • 🧵renameCollection()
    • 🧵renameColumn()
    • 🧵deleteColumn()
    • 🧵distinct()
    • 🧵countDocuments()
    • 🧵inspect()
    • 🧵aggregate()
  • 🔧Other Operators
    • 🆙Update Operators
      • ⚡$set
      • ⚡$unset
      • ⚡$inc
      • ⚡$dec
      • ⚡$push
      • ⚡$pull
      • ⚡$pop
    • 📡Filter & Process Operators
      • ⚡$limit
      • ⚡$skip
      • ⚡$sort
      • ⚡$upsert
      • ⚡$multiPull
  • 🪝SQL Config File
Powered by GitBook
On this page

Was this helpful?

  1. Other Operators
  2. Update Operators

$pull

Name
Usage Type
Description

$pull

Object

$pull Operator is Used to Pull to Array Type Data

/* Example Usage */
const model = ...Someone Model

(async () => {

await model.findOneAndUpdate({ name: "Test", age: 20, arr: ["test"] },{ $pull:{ arr:["test"] } });
// Or Other Usage
await model.findOneAndUpdate({ name: "Test", age: 20, arr: ["test"] },{ $pull:{ arr: function(data) { return data == "test" } } });

/*
The "arr" value that was ["test"] is now []
If you want to withdraw all the same values, use $multiPull:true in the Option Section
*/

})();
Previous$pushNext$pop

Last updated 1 year ago

Was this helpful?

🔧
🆙
⚡