Aldehydes and ketones exchange their hydrogens for deuteriums when treated with DO- /D2O or with D+ /D2O. In basic media the reaction proceeds through enolates and in acidic media the intermediates formed are enols.
The mechanism of hydrogen-deuterium exchange occurs in the following steps:
Stage 1. Formation of the enolate
Stage 2. Transfer from deuterium to enolate
Stage 3. Substitution of the rest of hydrogens