β‘$push
Name
Usage Type
Description
$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
Was this helpful?