Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{plonks:["plonk1","plonk2","plonk3"],_id:1001}]
Query
db.collection.update({},[{"$set":{"plonk":{"$arrayElemAt":["$plonks",-1]},"plonks":{"$slice":["$plonks",{"$subtract":[{"$size":"$plonks"},1]},],},}},])
Result