Database
[{matrix_id:1,row_id:0,values:[1,2,3]},{matrix_id:1,row_id:1,values:[4,5,6]},{matrix_id:2,row_id:0,values:[20,40,60]},{matrix_id:2,row_id:1,values:[80,100,120]}]
Query
db.collection.update({matrix_id:1,/** index of the row being updated*/row_id:0},[{$set:{values:{$let:{vars:{/** index of the column being updated*/col_idx:1,new_col_val:7890},in:{$concatArrays:[/** existing values before the replacement*/{$slice:["$values","$$col_idx"]},/** the replacement*/["$$new_col_val"],/** existing values after the replacement*/{$slice:["$values",{$add:["$$col_idx",1]},/** can subtract remaining length but* it doesn't affect the result*/{$size:"$values"}]}]}}}}}])