In MongoDB, you can use the $pop
operator to remove the first or last element from an array.
Use $pop
in conjunction with a method such as update()
to update the specified document with the change.
Use -1
to remove the first element, and 1
to remove the last.