Thanks to this new feature, you can now define type conversion from your model to your database type.
For example, consider the following mappings:
const mappingOptions = {
models: {
'User': {
tables: ['users'],
mappings: new UnderscoreCqlToCamelCaseMappings(),
columns: {
'info': {
fromModel: JSON.stringify,
toModel: JSON.parse
}
}
}
}
};
The Mapper will convert the data in the "info" column and represent it as a JavaScript object, and the other way around, for example, you can provide the value of the property as an Object.
await userMapper.insert({ userId, info: { birthdate, favoriteBrowser } });You can visit the
Mapper documentation section for
Defining Mappings for more information and. The complete list of new improvements and bug fixes is in the
changelog.
The new version is available on the npm registry.
Thanks,
Jorge