Você pode armazenar matriz como array embutido de duas formas.
1. Array unidimensional com width e height:
{ _id: "1", matrix: [1,2,3,4,5,6,7,8,9], width: 3, height: 3 }Para incrementar terceiro elemento:
db.matrix.update({_id: 1}, { $inc : { "matrix.2" : 1 } })2. Array de objetos com coordenadas xy:
db.matrix.update({_id: 1, "matrix.xy": "2-0" }, { $inc : { "matrix.$.v" : 1 } })Segunda forma facilita driver, mas armazena mais dados.