Set doc and updated metadata