Considered the first comprehensive historical record of the history of Vietnam, "Đại Việt sử ký" was compiled by Lê Văn Hưu in following the format of Sima Guang's "Zizhi Tongjian" (, "Comprehensive Mirror to Aid in Government"). During the period of compilation, Lê Văn Hưu had chance to witness one of the principal events of the Trần dynasty which was the war of resistance of Đại Việt against the second and third Mongol invasions. With the continuous threat from the northern border, Thái Tông and Thánh Tông commissioned Lê Văn Hưu to write the historical text so that the Trần clan could learn experiences from Đại Việt's past to enforce its ruling and affirm the independence of the country from China.