serialize document datas to database