I have an object like:
class Metadata {
@attribute()
valueA?: string;
@attribute()
valueB?: string;
}
@table("documents")
class Document {
@hashKey()
key: string;
@attribute({ memberType: embed(Metadata) })
metadata: Metadata;
}
Using DataMapper.update with the onMissing option set to skip, if I try to update a single property in the nested object, all missing properties are removed, not skipped as the option would suggest.
Sample code:
const doc = new Document();
doc.key = "<hashKey>";
doc.metadata = new Metadata();
doc.metadata.valueB = "new value";
const dataMapper = new DataMapper();
dataMapper.update(doc, { onMissing: 'skip' });
Result is that valueA gets stripped from the document.