backup database

fix bug change to specific metadata cannot be store if we change the
docuemnt's type