14 points

Append a Value to an Array


dashboard

Posted by [deleted user] #javascript #nodejs

db.students.update(
   { _id: 1 },
   { $push: { scores: 89 } }
)
content_copy

The processing of the push operation with modifiers occur in the following order, regardless of the order in which the modifiers appear: Update array to add elements in the correct position. Apply sort, if specified. Slice the array, if specified. Store the array.

https://docs.mongodb.com/manual/reference/operator/update/push/



LISTS WITH THIS SNIPPET

>> Browse more code snippets

more_vert