$push

NameUsage TypeDescription

$push

Object

$push Operator is Used to Add to Array Type Data

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

(async () => {

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

})();

Last updated