var cursor = db.places.find(); while (cursor.hasNext()) { var x = cursor.next(); for(var i=0; i < x["suites"].length; i++){ var fotos = Array(); for(var k=0; k < x["suites"][i]["fotos"].length; k++){ fotos[k] = {"fotos" : x["suites"][i]["fotos"][k] }; } x["suites"][i]["fotos"] = fotos; } db.places.update({_id : x._id}, x); }