$push Operator in MongoDB
The $push operator in MongoDB is used to update the array in MongoDB. It inserts a new value into the array in the specific index.
If the mentioned field is absent in the document to update, the $push operator adds it as a new field and includes the mentioned value as its element.
If the value is an array, the $push operator appends the whole array as a single element. To add each element of the value separately, the $push operator can be used with the $each modifier.
MongoDB $push Operator
MongoDB $push operator appends a value to the already existing array within a document.
Contact Us