$pull

NameUsage TypeDescription

$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" } });
/*
The "arr" value that was ["test"] is now []
If you want to withdraw all the same values, use $multiPull:true in the Option Section
*/

})();

Last updated