$pushAll

NameUsage TypeDescription

$pushAll

Object

$pushAll Operator is Used to Add to Array Type Data, But Type Is Array

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

(async () => {

await model.findOneAndUpdate({ name: "Test", age: 20, arr: [] },{ $pushAll:{ arr:["test","test123"] } });
/*
The "arr" value that was [] is now ["test","test123"]
*/

})();

Last updated