SERVER-10521 Introduce serializing/deserializing interface for types.