Hi @Francesco_Garrisi, and welcome to the MongoDB forums.
** This solution won’t work as $[]
updates all the array elements **
The following should let you update the last results
array.
db.arrayPush.updateOne(
{"_id": "670e362adbbe1ff03860a2e1"},
{$push: {"testHistory.$[].results": 5}}
);
$[]
indicates the last array element.