MongoDB 8 · Query and update operators

Add to an array

Append a value to an array field.

db.users.updateOne({ name: "Ada" }, { $push: { tags: "admin" } })

Official MongoDB 8 documentation

More query and update operators commands

All query and update operators commands · MongoDB 8 cheatsheet

Was this page helpful?